View Code of Problem 3698

#include<stdio.h>
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		long long n;
		scanf("%lld",&n);
			long long h=1,x=1,y=1,sum=1;
			while(n>sum){
				n-=sum;
				h++;
				sum+=h;
			}
			while(n>x){
				n-=x;
				x++;
			}
			printf("%lld %lld %lld\n",h,x,n);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3698