View Code of Problem 3698

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

Double click to view unformatted code.


Back to problem 3698