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 nature77 at 2009-04-07 10:52:14 on Problem 1067
In Reply To:我用打表法,可不知道为什么错了!牛人们看看呀 Posted by:jxnuxiaoyong at 2009-04-04 15:14:09
> #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:
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