View Code of Problem 3698

#include<stdio.h>
int main(){
	long long int t,n,i,j,k;
	scanf("%lld",&t);
	while(t--){
		scanf("%lld",&n);
	long long int s=1;
		for(i=2;n>s;i++){
			n-=s;
			s+=i;
		} 
		for(j=1;n>j;j++)
		{
			n-=j;
		 } 
		 printf("%d %d %d\n",i-1,j,n);
	}
	}
//这题需要注意复杂度要求 

Double click to view unformatted code.


Back to problem 3698