Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- ifstream in("pluton.in");
- ofstream out("pluton.out");
- int n, f[4005][10], k, v[4005][4005], x;
- int main() {
- in >> n;
- for(int i = 1; i <= n; i++) {
- in >> x;
- int y = x;
- if(y == 0)
- f[0][0]++;
- while(y) {
- f[0][y%10]++;
- y /= 10;
- }
- bool ik = false;
- for(int j = 1; j <= k && !ik; j++) {
- bool ok = true;
- for(int p = 0; p <= 9 && ok; p++)
- if(f[j][p] != f[0][p])
- ok = false;
- if(ok) {
- ik = true;
- v[j][++v[j][0]] = x;
- }
- }
- if(!ik) {
- k++;
- v[k][++v[k][0]] = x;
- for(int j = 0; j <= 9; j++)
- f[k][j] = f[0][j];
- }
- for(int j = 0; j <= 9; j++)
- f[0][j] = 0;
- }
- out << k << '\n';
- int mx = -1, cnt = 0;
- for(int i = 1; i <= k; i++)
- if(mx < v[i][0])
- mx = v[i][0], cnt = 1;
- else if(mx == v[i][0])
- cnt++;
- out << mx << '\n' << cnt << '\n';
- bool ik = false;
- for(int i = 1; i <= k && !ik; i++)
- if(mx == v[i][0]) {
- ik = true;
- for(int j = 1; j <= v[i][0]; j++)
- out << v[i][j] << " ";
- }
- in.close();
- out.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement