fork download
  1. #include<bits/stdc++.h>
  2.  
  3. #define ll long long
  4. #define pp push_back
  5. #define endl '\n'
  6. #define all(x) x.begin(),x.end()
  7. #define ld long double
  8. #define PI acos(-1)
  9. #define ones(x) __builtin_popcountll(x)
  10. //#define int ll
  11.  
  12. using namespace std;
  13.  
  14. void Drakon() {
  15. ios_base::sync_with_stdio(false);
  16. cin.tie(nullptr);
  17. cout.tie(nullptr);
  18. #ifdef Clion
  19. freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  20. #endif
  21. }
  22.  
  23. unsigned long long inf = 1e10;
  24. const double EPS = 1e-6;
  25. const int MOD = 1000000007, N = 200005, LOG = 25;
  26.  
  27. ll mul(const ll &a, const ll &b) {
  28. return (a % MOD + MOD) * (b % MOD + MOD) % MOD;
  29. }
  30.  
  31. ll add(const ll &a, const ll &b) {
  32. return (a + b + 2 * MOD) % MOD;
  33. }
  34.  
  35. ll pw(ll x, ll y) {
  36. ll ret = 1;
  37. while (y > 0) {
  38. if (y % 2 == 0) {
  39. x = mul(x, x);
  40. y = y / 2;
  41. } else {
  42. ret = mul(ret, x);
  43. y = y - 1;
  44. }
  45. }
  46. return ret;
  47. }
  48.  
  49. void solve() {
  50. int n;
  51. cin >> n;
  52. int ans = 0;
  53. for (int y = 1; y <= n; ++y) {
  54. for (int z = 1; z <= n; ++z) {
  55. if(1ll * y * z * 7 > n) break;
  56. int rem = n - y * z * 7;
  57. if(rem % 3 == 0) ans ++;
  58. }
  59. }
  60. cout << ans;
  61. }
  62.  
  63. signed main() {
  64. Drakon();
  65. int t = 1;
  66. //cin >> t;
  67. while (t--) {
  68. solve();
  69. }
  70. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Standard output is empty