Codeforces 1459A A. Red-Blue Shuffle Solution
Solution in C++:
///**********ALLAH IS ALMIGHTY************///
///AH Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t,n,rc,bc,i;
- string r,b;
- cin>>t;
- while(t--)
- {
- rc=0,bc=0;
- cin>>n>>r>>b;
- for(i=0; i<n; i++)
- {
- if(r[i]>b[i])
- rc++;
- else if(r[i]<b[i])
- bc++;
- else
- {
- rc++;
- bc++;
- }
- }
- if(rc>bc)
- cout<<"RED"<<endl;
- else if(bc>rc)
- cout<<"BLUE"<<endl;
- else
- cout<<"EQUAL"<<endl;
- }
- }
No comments