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 crazyfeather at 2008-03-23 22:21:12 on Problem 3543
In Reply To:我就是这么算的 Posted by:include_dhj at 2008-03-23 21:41:57
> 我就是这么做的,可是还是wrong answer,我这是第一次参加,把你代码发下看看,我看看格式怎么输入的吧,谢谢
#include <iostream>

using namespace std;
int main()
{
    int b,w;
    while(cin>>b>>w)
        {
            int sum = 0;
            if (b==0&&w==0)
                cout << "Impossible" << endl;
            else if (b==1&&w!=1||b!=1&&w==1||b==1&&w==1)
                cout << "1" << endl;
            else
            {
                if (b < w)
                    sum = 2*b+1;
                else if (w < b)
                    sum = 2*w+1;
                else if (w = b)
                    sum = w+b;
                int i = 1;
                while (i)
                {
                    if (sum<i*i)
                        {
                            cout << i-1 << endl;
                            break;
                        }
                    else
                        i++;
                }
            }
        }
    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