Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Bismillahir Rahman-ir Rahim
- #include <bits/stdc++.h>
- using namespace std;
- #define MAX 1000000
- #define PI acos(-1)
- #define debug(x) cout << '>' << #x << " : " << x << endl;
- #define all(c) c.begin(), c.end()
- #define F first
- #define S second
- #define pb push_back
- #define mp make_pair
- typedef unsigned long long ull;
- typedef long long ll;
- typedef vector< int > vi;
- int char_to_num(char c){
- return c - '0';
- }
- int sod(string str){
- int sum = 0;
- for(int i = 0; i < str.size(); i++){
- sum += char_to_num(str[i]);
- }
- return sum;
- }
- int main()
- {
- //freopen("input.txt", "r", stdin);
- //freopen("output.txt", "w", stdout);
- int T;
- cin >> T;
- while(T--) {
- int n, nA = 0, nB = 0;
- cin >> n;
- string A, B;
- for(int i = 0; i < n; i++){
- cin >> A >> B;
- if(sod(A) > sod(B)) nA++;
- else if(sod(A) < sod(B)) nB++;
- else{
- nA++;
- nB++;
- }
- }
- if(nA > nB){
- cout << 0 << ' ' << nA << endl;
- }
- else if(nA < nB){
- cout << 1 << ' ' << nB << endl;
- }
- else cout << 2 <<' ' <<nA << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement