EEOJ/OJ1/dec.cpp

38 lines
782 B
C++

#include<iostream>
#include<fstream>
#include<algorithm>
#include<stdlib.h>
#include<math.h>
using namespace std;
//fstream file("oj1.txt", ios::in);
int pows[10] = { 1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000};
int numPos(int num, int pos) {
return (num / pows[pos]) % 10;
}
int main() {
//std::ios::sync_with_stdio(false);
int a[10][10]={0};
int n, num,pos,ansnum=0;
int ans[10];
cin >> n;
//file >> n;
for (int i = 0; i < 3*n-1; i++) {
cin >> num;
//file >> num;
for (pos = 0; pos < 10; pos++) {
a[numPos(num, pos)][pos] += 1;
}
}
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
if (a[j][i] % 3) {
ans[9-i] = j;
}
}
}
for (int i = 0; i < 10; i++) {
ansnum *= 10;
ansnum += ans[i];
}
cout << ansnum;
}