View Code of Problem 3698

#include<stdio.h>
int main(void){
	int t;
	scanf("%d",&t);
	while(t--){
		double n,h=1,sum=1,l=1;
		scanf("%lf",&n);
		while(n>sum){
			n-=sum;
			h++;
			sum+=h;
		}
		while(n>l){
			n-=l;
			l++;
		}
		printf("%.0lf %.0lf %.0lf\n",h,l,n);
	}
}

Double click to view unformatted code.


Back to problem 3698