View Code of Problem 3698

#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n;
	cin>>n;
	while(n--){
		long long tmp,dui = 1,sum = 1,ceng = 1;
		cin>>tmp;
		while(tmp > sum){
			tmp -= sum;
			dui++;
			sum += dui;
		}
		while(tmp > ceng){
			tmp -= ceng;
			ceng++;
		}
		cout<<dui<<" "<<ceng<<" "<<tmp<<endl;
		
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 3698