Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* TAHMID RAHMAN
- DAMIAN FOREVER
- MATH LOVER
- NEVER GIVE UP
- */
- #include<bits/stdc++.h>
- using namespace std;
- #define pi acos(-1.0)
- #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
- #define ll long long
- #define pb push_back
- #define fi first
- #define se second
- #define in insert
- #define mp make_pair
- #define GCD(a,b) __gcd(a,b);
- #define endl "\n"
- #define FRU freopen("out.txt","w",stdout)
- #define FRO freopen("in.txt","r",stdin)
- #define INFLL 9223372036854775807
- #define debug 0
- #define MAXN 100001
- #define ar array
- const int mxN=2e5;
- const int MOD=1e9+7;
- bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
- {
- return (a.second < b.second);
- }
- #define debugxx(v) {for(auto x:v){cout<<x.fi<<" "<<x.se<<endl;}cout<<endl;}
- #define debugx(v){for(auto y:v) {cout<<y<<" ";}cout<<endl;}
- //Don't hesitate to ask me if you don't understand my code.......Happy coding,Tahmid...;
- int main()
- {
- fastio;
- ll t;
- //t=1;
- cin>>t;
- while(t--)
- {
- ll n,i;
- cin>>n;
- ll ans=0,sum=0;
- ll temp=0;
- while(n>=2)
- {
- if(n==2)
- {
- ans++;
- break;
- }
- for(i=2; ;i++)
- {
- if((i*2+i*(i-1)*3*0.5)>n)
- {
- i--;
- temp=i*2+i*(i-1)*3*0.5;
- ans++;
- n-=temp;
- break;
- }
- }
- }
- cout<<ans<<endl;
- }
- }
Add Comment
Please, Sign In to add comment