View Code of Problem 3698

#include<stdlib.h>
#include<stdio.h>

int main(){
	long long tc,n;
	scanf("%lld",&tc);
	while(tc--){
		scanf("%lld",&n);
		long long a=0,b=0;
		while(n>a+b+1){
			a++;
			b = b + a;
			n = n - b;
		}
		a++;//堆
		b = 1;
		while(n-b>0){
			n = n - b;
			b++; //行
		}
		long long c = n;
		printf("%lld %lld %lld\n",a,b,c);
	
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 3698