#include <stdio.h> #include <string.h> #include<math.h> int main() { int t; scanf("%d", &t); while (t--) { long long n, x = 1; scanf("%lld", &n); long long a = 0, b = 0, c = 0; while (x <= n) { a++; x += a * (a + 1) / 2; } x -= a * (a + 1) / 2; long long m = n - x; while (b * (b + 1) / 2 <= m) { b++; } c = m - (b - 1)*b / 2 + 1; printf("%lld %lld %lld\n", a, b, c); } } |
Double click to view unformatted code.