Guest User

Untitled

a guest
Jul 2nd, 2018
643
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Written by Sayutin Dmitry
  2.  
  3. #include <bits/stdc++.h>
  4.  
  5. using namespace std;
  6.  
  7. template <typename T>
  8. T input() {
  9.     T res;
  10.     cin >> res;
  11.     return res;
  12. }
  13.  
  14. #define ALL(A) A.begin(), A.end()
  15. #define SZ(A) int(A.size())
  16.  
  17. int main() {
  18.     std::iostream::sync_with_stdio(false);
  19.     cin.tie(NULL);
  20.     cout.tie(NULL);
  21.    
  22.     int n = input<int>();
  23.  
  24.     const int max_go = 49;
  25.  
  26.     bool good[max_go + 1][max_go + 1];
  27.     for (int i = 0; i <= max_go; ++i)
  28.         for (int j = 0; j <= max_go; ++j)
  29.             good[i][j] = 1;
  30.  
  31.     for (int i = 0; i <= max_go; ++i)
  32.         for (int j = 0; j <= max_go; ++j)
  33.             for (int iprime = 0; iprime <= max_go; ++iprime)
  34.                 for (int jprime = 0; jprime <= max_go; ++jprime)
  35.                     if (4 * iprime + 9 * jprime < 4 * i + 9 * j and (4 * i + 9 * j) % 49 == (4 * iprime + 9 * jprime) % 49)
  36.                         good[i][j] = 0;
  37.  
  38.     int64_t ans = 0;
  39.     for (int num4 = 0; num4 <= n and num4 <= max_go and num4 < 9; ++num4)
  40.         for (int num9 = 0; num9 + num4 <= n and num9 <= max_go; ++num9)
  41.             if (good[num4][num9])
  42.                 ans += (n - num9 - num4 + 1);
  43.  
  44.     cout << ans << "\n";
  45.    
  46.     return 0;
  47. }
RAW Paste Data