Plabon_dutta

Codeforces Round #734 (Div. 3), problem: (A) Polycarp and Coins

Jul 23rd, 2021
919
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define pi acos(-1.0)
  6. #define ll long long int
  7. #define sc scanf
  8. #define pf printf
  9. #define fin for(ll i=0; i<n; i++)
  10. #define fjm for(ll j=0; j<m; j++)
  11. #define fr(i,a,n) for(ll i=a; i<n; i++)
  12. #define rf(i,n,a) for(ll i=n-1; i>=a; i--)
  13. #define nl "\n"
  14. #define readfirst() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
  15.  
  16. ll gcd(ll p, ll q) {
  17.     return q==0?p:gcd(q,p%q);
  18. }
  19.  
  20. int main() {
  21.     readfirst();
  22.     ll t, n;
  23.     cin >> t;
  24.     while(t--) {
  25.         cin >> n;
  26.         if(n%3==0) cout << n/3 << " " << n/3 << nl;
  27.         else if((n-1)%3==0) cout << ((n-1)/3)+1 << " " << (n-1)/3 << nl;
  28.         else if((n-2)%3==0) cout << (n-2)/3 << " " << ((n-2)/3)+1 << nl;
  29.     }
  30.     return 0;
  31. }
RAW Paste Data