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 jimmyzzxhlh1 at 2005-01-09 15:47:43 on Problem 2140
In Reply To:Re:怎么才能不超时???我已经很费力了!!! Posted by:90405129 at 2004-12-26 01:06:30
我贴一下我的程序~这道题目应该只要1重循环就够了~
#include<iostream.h>
int main()
{
  long n,i,j,l;
  cin>>n;
  j = 0;
  for (i = 1; i <= n; i++)
  if (n % i == 0)
  {
    if (i % 2 == 1) j++;
    else
    {
      l = (n + n) / i - i - 1;
      if (l % 2 == 0) j++;
    }
  }
  cout<<j<<endl;
  return 0;
}

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