You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.1 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <bits/stdc++.h>
using namespace std;
bool isAllZero(string s) {
for (int i = 0; i < s.size(); i++)
if (s[i] != '0')
return false;
return true;
}
struct Node {
char c; //字符
int count;//个数
int st, ed;//开始位置,停止位置
bool const operator<(const &Node t) {
// 如果数量不相等,那么数量多的在前
if (count != t.count)
return count > t.count;
// 如果数量相等,是不是存在区间包含
if (st < t.st && ed > t.ed)//两个结构体对比,如果第一个包含第二个,那么第一个在前,否则第二个在前
return false;
//默认值是第二个在前
return true;
}
};
int b[10];
void tj() {
memset(b, 0, sizeof b);
vector<pair<int, int>> q;
for (int i = 0; i < s.size(); i++) {
if (s[i] != '0')
b[s[i] - '0']++;
}
for (int i = 1; i <= 9; i++)
if (b[i])
q.push_back({ b[i], i});
sort(q.begin(), q.end());
for (int i = 0; i < q.size(); i++)
//TODO 最多的数量还没有记录起止位置需要继续实现
}
vector<Node> a;
int main() {
int n;
string s;
cin >> n >> s;
while (!isAllZero(s)) {
}
return 0;
}