Advertisement
Guest User

Untitled

a guest
May 27th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <iostream>
  3. #include <cstdio>
  4. //#define scanf scanf_s
  5. #define forn(i,n) for(int i=0;i<n;++i)
  6. #define max(a,b) ((a>b)?(a):(b))
  7. using namespace std;
  8. int n, k;
  9.  
  10. int d[33000];
  11.  
  12. inline void calc() {
  13.  
  14. int n = 33000 - 1;
  15.  
  16. for (int i = 0;i*i <= n;++i)
  17. for (int j = 0;j <= i && i*i + j*j <= n;++j)
  18. for (int g = 0;g <= j && i*i + j*j + g*g <= n;++g)
  19. for (int h = 0;h <= g && i*i + j*j + g*g + h*h <= n;++h)
  20. ++d[i*i + j*j + g*g + h*h];
  21.  
  22.  
  23. }
  24.  
  25. int main() {
  26. int t;
  27. scanf("%d", &t);
  28. calc();
  29. int n;
  30. while (t--) {
  31. scanf("%d",&n);
  32. printf("%d\n", d[n]);
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement