| ||||||||||
| 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:狂晕,用C++交WA,用G++交AC,到底是怎么回事啊??In Reply To:狂晕,用C++交WA,用G++交AC,到底是怎么回事啊?? Posted by:apple0227 at 2007-08-06 15:22:50 > #include<iostream.h>
>
> #include<stdio.h>
> #include<math.h>
> __int64 fab(__int64 a)
> {
> if(a>=0) return a;
> else return -a;
> }
> int main()
> {
> __int64 x,y,n,sum,m,rest;
> int N;
> cin>>N;
> while(N--)
> {
> scanf("%I64d%I64d",&x,&y);
> m=fab(x-y);
> if(m==0) cout<<"0"<<endl;
> else{
> sum=0; n=1;
> while((sum+n+n-1)<m)
> {
> sum+=(n+n-1);
> n++;
> }
> rest=m-sum;
> if(rest<n&&rest>0)
> printf("%I64d\n",2*n-2);
> else
> printf("%I64d\n",2*n-1);}
> }
>
> return 0;
> }
change "#include<iostream.h>" to
#include<iostream>
using namespace std;
just like this, and you can make it.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator