Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <iostream>
- using namespace std;
- const int MAX=1e6+11;
- long long dp[MAX];
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);cout.tie(0);
- dp[1]=6;
- for(int i=2;i<=1e6;i++)
- {
- dp[i]=max(dp[i],dp[i-1]+i*3+2);
- }
- long long n,ans=0;
- cin>>n;
- for(int i=1;i<=1e6;i++)
- {
- if(n>=dp[i]) ans=i;
- else break;
- }
- cout<<ans<<"\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment