Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
水过40题··#include<iostream> using namespace std; int main() { int t; int i; int num; int count; int tcase; double x; scanf("%d",&t); while(t--) { scanf("%d%d",&tcase,&num); count = 0; for(i = 2; ; i++) { x = (num*1.0/i*2-i+1) / 2; if(x <= 0) { break; } if(x == int(x)) { count++; } } printf("%d %d\n",tcase,count); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator