| ||||||||||
| 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 | |||||||||
Re:无限超时啊,,求大神支招、、In Reply To:无限超时啊,,求大神支招、、 Posted by:yang_xiongwei at 2012-07-31 10:23:19 i*(i+1)/2<t
附代码c++
#include <stdio.h>
int main()
{
long long num,cas,t,n,a,cnt;
scanf("%I64d",&t);
while(t--)
{
scanf("%I64d%I64d",&cas,&num);
cnt=0;num*=2;
for(n=2;n*n<num;n++)
if(num%n==0)
{
a=(num/n)-n+1;
if(a%2==0)cnt++;
}
printf("%I64d %I64d\n",cas,cnt);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator