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> #define maxsize 500000001 using namespace std; int main() { long a[maxsize],b[maxsize]; a[0]=0; b[0]=0; b[1]=2; long j=1,k=1; for(long i=1;i<=maxsize;i++) { if(j==b[k]) { j++; k++; } a[i]=j; b[i]=j+i; j++; } while(1) { long ax,bx,term; cin>>ax>>bx; if(ax>bx) { term=ax; ax=bx; bx=term; } int f=1; for(long i=0;ax>=a[i];i++) { if(ax==a[i] && bx==b[i]) { f=0; break; } } cout<<f<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator