View Code of Problem 3698

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

Double click to view unformatted code.


Back to problem 3698