t = int(input())
for _ in range(t):
n = int(input())
c = 0
def main(num):
global c
z = 2
while num >= 2:
if num-z < 0:
c+=1
return num
elif num == 0:
c+=1
return num
else:
num-=z
z+=3
c+=1
if num > 0 and num < 2:
return num
elif num == 2:
c+=1
return 0
else:
return num
while n >= 2:
n=main(n)
print(c)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t; cin >>t;
while (t--)
{
int n; cin >>n;
int count=0;
int x=1;
while (n>1)
{
if (n<7)
{count+=n/2;break;}
else if (n==7||n==8)
{count++;break;}
int a=(n/3)*2;
int b=sqrt(a)-x;
int c=(b*(b+1)/2)*3;
int d=(b+1)*2;
n-=c+d;
if (n<0)
{n+=c+d;x++;}
else
{count++;x=1;}
}
cout <<count<<endl;
}
return 0;
}
1450A - Avoid Trygub | 327A - Flipping Game |
411A - Password Check | 1520C - Not Adjacent Matrix |
1538B - Friends and Candies | 580A - Kefa and First Steps |
1038B - Non-Coprime Partition | 43A - Football |
50A - Domino piling | 479A - Expression |
1480A - Yet Another String Game | 1216C - White Sheet |
1648A - Weird Sum | 427A - Police Recruits |
535A - Tavas and Nafas | 581A - Vasya the Hipster |
1537B - Bad Boy | 1406B - Maximum Product |
507B - Amr and Pins | 379A - New Year Candles |
1154A - Restoring Three Numbers | 750A - New Year and Hurry |
705A - Hulk | 492B - Vanya and Lanterns |
1374C - Move Brackets | 1476A - K-divisible Sum |
1333A - Little Artem | 432D - Prefixes and Suffixes |
486A - Calculating Function | 1373B - 01 Game |