#include<cstdio> #include<cmath> using namespace std; int main() { int n, t, ways, z; scanf("%d", &t); for (int i = 0; i < t; i++) { scanf("%d", &n); ways = 0; for (int x = 0; x <= 1000; x++) for (int y = x; y <= 1000; y++) { if(n - x * x - y * y < 0) break; z = sqrt(n - x * x - y * y); if(z <= 1000 && z * z == (n - x * x - y * y)) { if(x == y) ways++; else ways += 2; } } printf("%d\n", ways); } return 0; }
No hay comentarios:
Publicar un comentario