Another Card Game Problem Problem Code: CRDGAME3 Codechef Solution

 #include <bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int t;
  cin>>t;
  while(t--){
    int c,r;
    cin>>c>>r;
    int val,p,ans=0;
    if(c/9<r/9)p=0,val=c;
    else p=1,val=r;
    ans=val/9+((val%9)?1:0);
    cout<<p<<' '<<ans<<'\n';
  }
  return 0;
}

Comments