Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<stdio.h>
- #include<vector>
- #define pb push_back
- #define ll long long
- using namespace std;
- ll ans, n, m = 1;
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin >> n;
- while(true)
- {
- ll cur = 3 * ((m * (m + 1)) / 2) - m;
- if(cur > n)
- break;
- if((n - cur) % 3 == 0)
- ans++;
- m++;
- }
- cout << ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement