//2011 07 05
//poj 2853
//daun
#include <iostream>
using namespace std;
int main()
{
int count = 0;
int number = 0;
int answer = 0;
int i = 0;
int sum = 0;
cin >> count;
while(i!=count)
{
cin >> i;
sum = 0;
answer = 0;
cin >> number;
for(int a = number; a> 0 ; a--)
{
sum = a;
for(int b = a -1; b > 0 ; b--)
{
sum+=b;
if(sum == number)
answer++;
}
}
cout <<i<<" " << answer << endl;
}
return 0;
}
'Code > Algorism' 카테고리의 다른 글
[ALGORISM]poj 1218 (0) | 2011.09.03 |
---|---|
[ALGORISM]poj 1298 (0) | 2011.09.03 |
[ALGORISM]poj 1077 (0) | 2011.09.03 |
[ALGORISM]poj 1163 (0) | 2011.09.03 |
[ALGORISM]poj 1003 (0) | 2011.09.03 |