| ||||||||||
| 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:我就是这么算的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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator