View Code of Problem 3698

#include<stdio.h>
#include<math.h>
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
	
	long long sum=1;
	long long duishu=1;
	long long n;//秒数
	scanf("%lld",&n);
	long long hang=1;
	while(n>sum){
		n-=sum;
		duishu++;
		sum+=duishu;
	}
	while(n>hang){
		n-=hang;
		hang++;
	}
	printf("%lld %lld %lld\n",duishu,hang,n);//堆 行 列 
} 
}

Double click to view unformatted code.


Back to problem 3698