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

哪个大牛帮忙看看,我觉得和别人的也没什么不同为什么不对呢?

Posted by cicely at 2007-08-04 18:02:18 on Problem 2140
#include"iostream"
#include"math.h"
using namespace std;
int main()
{
    int n,time=0,mid;
    freopen("2140.txt","r",stdin);
    freopen("02140.txt","w",stdout);
    cin>>n;
    for(int i=1;i<=n/2;i++)
    { 
        if((1-4*(i-i*i-2*n))>=0)
        {
         mid=(int)sqrt((double)(1-4*(i-i*i-2*n)));
         mid=(mid-1)/2;
          if(n==(i+mid)*(mid-i+1)/2&&mid>i)
          time++;}
     }    
     time++;
cout<<time<<endl;
  }    
    

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