-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCRDGAME.cpp
More file actions
47 lines (44 loc) · 1.04 KB
/
CRDGAME.cpp
File metadata and controls
47 lines (44 loc) · 1.04 KB
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
#include <bits/stdc++.h>
using namespace std;
int main(){
unsigned short t, N, chef_scr, morty_scr;
long int A_temp,B_temp, A,B,A_sum,B_sum;
cin>>t;
while (t--)
{
cin>>N;
chef_scr = 0;
morty_scr = 0;
while(N--){
A_sum = 0;
B_sum = 0;
cin>>A>>B;
while(A){
A_temp = A%10;
A_sum+=A_temp;
A/=10;
}
while(B){
B_temp = B%10;
B_sum+=B_temp;
B/=10;
}
if(A_sum > B_sum){
chef_scr +=1;
} else if(A_sum == B_sum){
chef_scr+=1; morty_scr+=1;
}
else {
morty_scr +=1;
}
}
if (chef_scr > morty_scr){
cout<<0<<'\t'<<chef_scr<<endl;
} else if(chef_scr == morty_scr){
cout<<2<<'\t'<<chef_scr<<endl;
} else {
cout<<1<<'\t'<<morty_scr<<endl;
}
}
return 0;
}