| ||||||||||
| 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 | |||||||||
哪个大牛帮忙看看,我觉得和别人的也没什么不同为什么不对呢?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator