#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
if(s[0]=='A'){
int n,t;
cin>>n>>t;
while(t--){
long long x;
cin>>x;
vector<vector<int>>xd(10,vector<int>(10,0));
int k=9;
while(x){
int w=x%10;
while(w>0){
xd[k][w]=1;
w--;
}
k--;
x=x/10;
}
for(int j=0;j<10;j++){
for(int i=0;i<10;i++){
cout<<xd[i][j];
}
cout<<endl;
}
}
}
else
{
int n,t;
cin>>n>>t;
while(t--){
long long ww=0;
vector<string>a(10);
for(auto &x:a)
cin>>x;
for(int i=0;i<10;i++){
int ile=0;
for(int j=0;j<10;j++){
auto x=a[j][i];
if(x=='1')
ile++;
}
ww+=((pow(10,10-i-1)*ile));
}
cout<<ww<<endl;
}
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #include <bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; if(s[0]=='A'){ int n,t; cin>>n>>t; while(t--){ long long x; cin>>x; vector<vector<int>>xd(10,vector<int>(10,0)); int k=9; while(x){ int w=x%10; while(w>0){ xd[k][w]=1; w--; } k--; x=x/10; } for(int j=0;j<10;j++){ for(int i=0;i<10;i++){ cout<<xd[i][j]; } cout<<endl; } } } else { int n,t; cin>>n>>t; while(t--){ long long ww=0; vector<string>a(10); for(auto &x:a) cin>>x; for(int i=0;i<10;i++){ int ile=0; for(int j=0;j<10;j++){ auto x=a[j][i]; if(x=='1') ile++; } ww+=((pow(10,10-i-1)*ile)); } cout<<ww<<endl; } } } |
English