pku2853
//题目的讨论中有另外一种的解法,不过下边这种方法也可以
//此题跟2140是有区别的
1
#include
<
iostream
>
2 #include < cmath >
3 using namespace std;
4
5 int main()
6 {
7 int n;
8 cin>>n;
9 while(n--)
10 {
11 int pronum;
12 double x1,x2;
13 long number, result=0,j,x3;
14 cin>>pronum>>number;
15 x1=number;
16 x2=sqrt(float(2 * number));
17 x3=long(x2);
18 for(j=2;j < x3+1;j++)
19 if((2 * number % j == 0) && (j + 2 * number / j) % 2 != 0)
20 result++;
21 cout<<pronum<<" "<<result<<endl;
22 }
23
24 return 0;
25}
26
27
2 #include < cmath >
3 using namespace std;
4
5 int main()
6 {
7 int n;
8 cin>>n;
9 while(n--)
10 {
11 int pronum;
12 double x1,x2;
13 long number, result=0,j,x3;
14 cin>>pronum>>number;
15 x1=number;
16 x2=sqrt(float(2 * number));
17 x3=long(x2);
18 for(j=2;j < x3+1;j++)
19 if((2 * number % j == 0) && (j + 2 * number / j) % 2 != 0)
20 result++;
21 cout<<pronum<<" "<<result<<endl;
22 }
23
24 return 0;
25}
26
27