View Code of Problem 3698

#include <iostream>
#include <iomanip>
using namespace std;

int main() {
	int tc;
	cin >>tc;
	while(tc--){
		long long t,temp=0;
		cin >>t;
		long long h=t;
		long long x=0,y=0,z=0;
		long long i=1,sum=0;
		while(t>0){
			
			temp+=i;
			sum+=temp;
			t=t-temp;
			x++;
			i++;
		}
		long long m=t+temp;

		i=0;
		while(m>0){
			i++;
			m=m-i;
			y++;
		}

		z=i+m;
		cout <<x<<" "<<y<<" "<<z<<endl;
		
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3698