#include int tri(int k) { int num = k * (k + 1) / 2; return num; } int main(void) { int N; int tri1,tri2; int k = 1; int m = 1; scanf("%d", &N); //1つか2つの三角数のどちらかを判定 do{ tri1 = tri(k); if (N == tri1) { printf("1\n"); return 1; } m = k; do{ tri2 = tri(m); if (N == tri1 + tri2) { printf("2\n"); return 2; } m++; } while (N > tri1 + tri2); k++; } while (N > tri1); printf("3\n"); return 0; }