main
黄海 1 year ago
parent 76df6e9d66
commit 486530f7c7

@ -0,0 +1,58 @@
#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;
}
Loading…
Cancel
Save