View Code of Problem 3698

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

int main() {
	int tc;
	cin >>tc;
	while(tc--){
		double t,temp=0;
		cin >>t;
		double x=0,y=0,z=0;
		double i=1;
		while(t>0){
			temp+=i;
			t=t-temp;
			x++;
			i++;
		}
		double m=t+temp;
		
		i=0;
		//double temp1=0;
		while(m>0){
			i++;
			m=m-i;
			y++;
			//cout <<m<<endl;
		}
		//cout <<i<<endl;
		z=i+m;
		cout <<x<<" "<<y<<" "<<z<<endl;
		
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3698