Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:无限超时啊,,求大神支招、、

Posted by severinzhong at 2012-08-20 22:16:09 on Problem 2853
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator