import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scanner=new Scanner(System.in); int t=scanner.nextInt(); while(t-->0) { long n=scanner.nextLong(); long heap=1; long sum=1; while(n>sum) { n-=sum; heap++; sum+=heap; } long line=1; while(n>line) { n-=line; line++; } System.out.println(heap+" "+line+" "+n); } } } |
Double click to view unformatted code.