fork(1) download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5.  
  6. long long count (long long N)
  7. {
  8. long long d = 0;
  9. long long c = sqrt(N);
  10. long long l, r;
  11. long long x, y;
  12. for (long long i=2; i<=c; i++)
  13. {
  14. if (N%i==0)
  15. {
  16. x = N/i;
  17. y = i;
  18. if ((y+x-1)%2==0)
  19. {
  20. r = (y+x-1)/2;
  21. l = x - r;
  22. if (l>=1 && r>l)
  23. d++;
  24. }
  25. }
  26. }
  27. return d;
  28. }
  29.  
  30. int main ()
  31. {
  32. int t;
  33. cin>>t;
  34. int n;
  35. long long X;
  36. while (1)
  37. {
  38. if (t==0) break;
  39. t--;
  40. cin>>n;
  41. cin>>X;
  42. cout<<n<<" "<<count(2*X)<<endl;
  43. }
  44. return 0;
  45. }
Success #stdin #stdout 0s 4396KB
stdin
7  
1 6  
2 9  
3 8  
4 1800  
5 987654321  
6 987654323  
7 987654325
stdout
1 1
2 2
3 0
4 8
5 17
6 1
7 23