Niloy007

What's Next

Jun 28th, 2020
104
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. #define MAX 100005
  3. #define MOD 1e9
  4. #define pb push_back
  5. #define pairs pair<int, int>
  6. #define vi vector<int>
  7. #define vb vector<bool>
  8. #define vii vector<pairs>
  9. #define lb lower_bound
  10. #define ub upper_bound
  11. #define ll long long
  12. #define endl '\n'
  13. using namespace std;
  14. /* ----------------------------------------------------------------------------------- */
  15.  
  16. #define fastInput ios_base::sync_with_stdio(false), cin.tie(NULL);
  17. #define all(x) x.begin(), x.end()
  18. #define scan(a) scanf("%d", &a)
  19. #define scanll(a) scanf("%lld", &a)
  20. #define scanD(a) scanf("%lf", &a)
  21. #define print(a) printf("%d\n", a)
  22. #define printll(a) printf("%lld\n", a)
  23. #define printD(a) printf("%lf\n", a)
  24. #define printTwo(a) printf("%.2lf\n", a);
  25. #define read(x) freopen(x, "r", stdin)
  26. #define write(x) freopen(x, "w", stdout)
  27. #define rep(i, a, n) for (int i = a; i < n; i++)
  28. #define REP(i, a, n) for (int i = a; i <= n; i++)
  29. #define inputArray(a,n) rep(i, 0, n) cin >> a[i];
  30. #define copyArray(a,temp,n) rep(i, 0, n) temp[i]=a[i];
  31. #define printArray(a,n) rep(i, 0, n) cout << a[i] << " "; cout << endl;
  32.  
  33. /* ----------------------------------------------------------------------------------- */
  34.  
  35. #define Cases  cout << "Case " << ++Case << ": ";
  36. #define __test int tt; int Case=0; cin >> tt; while(tt--)
  37. #define showTime cerr << "time = " << (clock() / CLOCKS_PER_SEC) << " sec" << '\n';
  38.  
  39. #define dbgA2(A, n, m) {cout<<"--> "<<#A<<" = \n";rep(i, 0, n){rep(j, 0, n){cout<<A[i][j]<<" ";}cout<<"\n";}cout<<"\n";}
  40. #define dbgA(A, n) {cout<<" --> "<<#A<<" = (";rep(i, 0, n)cout<<A[i]<<" ";cout<<")\n";}
  41. #define dbg(args...) {string sss(#args);sss+=',';cout<<" --> ";debugger::call(all(sss), args);cout<<"\n";}
  42.  
  43. /* ----------------------------------------------------------------------------------- */
  44.  
  45. ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
  46. ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
  47.  
  48. struct debugger {
  49.     typedef string::iterator si;
  50.     static void call(si it, si ed) {}
  51.     template<typename T, typename ... aT>
  52.     static void call(si it, si ed, T a, aT... rest) {
  53.         string b;
  54.         for(; *it!=','; ++it)
  55.             if(*it!=' ')
  56.                 b+=*it;
  57.         cout << b << "=" << a << " ";
  58.         call(++it, ed, rest...);
  59.     }
  60. };
  61.  
  62. /* ----------------------------------------------------------------------------------- */
  63.  
  64.  
  65.  
  66. void solve() {
  67.     int a, b, c;
  68.     while (cin >> a >> b >> c) {
  69.         if(a == 0 && b == 0 && c == 0) {
  70.             return;
  71.         }
  72.         int ap = 0, gp = 0;
  73.         ap = (b - a);
  74.         gp = b / (a * 1.0);
  75.         if (ap == (c - b)) {
  76.             printf("AP ");
  77.             print(ap + c);
  78.         } else {
  79.             printf("GP ");
  80.             print(c * gp);
  81.         }
  82.     }
  83. }
  84.  
  85. int main() {
  86. #ifdef Niloy
  87.     read("input.txt");
  88.     write("output.txt");
  89. #endif
  90.  
  91.     solve();
  92.  
  93.     // __test {
  94.     //  solve();
  95.     // }
  96.  
  97.     showTime;
  98.     return 0;
  99. }
RAW Paste Data