-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathCRDGAME.cpp
More file actions
57 lines (53 loc) · 787 Bytes
/
CRDGAME.cpp
File metadata and controls
57 lines (53 loc) · 787 Bytes
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
53
54
55
56
57
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int isalpha(int *str, int n)
{
int sum = 0;
for(int i = 0; i < n-1; i++)
{
sum += (str[i+1] - str[i]-1);
}
return sum;
}
ll sumOFDigit(ll n)
{
ll sum = 0;
while(n > 0)
{
sum += num%10;
n /= 10;
}
return sum;
}
int main(){
int test;
cin >> test;
while(test--)
{
ll n;
vector<ll> a,b;
ll x, y;
ll sum = 0;
ll l=0;
for(ll i = 0; i< n; i++)
{
cin >> x >> y;
ll ans1 += sumOFDigit(x);
ll ans2 += sumOFDigit(y);
}
if(ans1 > ans2)
{
cout << 0 << " "<< ans1-ans2 << endl;
}
else if(ans1 < ans2)
{
cout << 1 << " "<< ans2-ans1 << endl;
}
else
{
cout << 2 << " " << ans1 << endl;
}
}
return 0;
}