Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream fin("concurs.in");
- ofstream fout("concurs.out");
- int C, N, suma, smax, nrmax, v[4], ec, ecmax;
- long long x;
- int main()
- {
- int i;
- fin>>C;
- fin>>N;
- for(i=1; i<=N; ++i)
- {
- fin>>ec>>x;
- suma=0;
- while(x)
- {
- if(x%10==0)
- {
- suma+=10;
- x/=100;
- }
- else
- {
- suma+=x%10;
- x/=10;
- }
- }
- if(suma>smax)
- {
- smax=suma;
- nrmax=1;
- }
- else if(suma==smax)
- nrmax++;
- v[ec]+=suma;
- if(v[ec]>ecmax)
- ecmax=v[ec];
- }
- if(C==1)
- {
- fout<<smax<<" "<<nrmax;
- return 0;
- }
- if(ecmax==0)
- fout<<"FARA CAMPION";
- else
- {
- for(i=1; i<4; ++i)
- if(v[i]==ecmax)
- fout<<i<<" ";
- fout<<ecmax;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement