poj3543

简单题

View Code
#include <iostream>
#include
<cstdio>
#include
<cstdlib>
#include
<cstring>
using namespace std;

int main()
{
//freopen("t.txt", "r", stdin);
int a, b;
scanf(
"%d%d", &a, &b);
if (a == 0 && b == 0)
{
printf(
"Impossible\n");
return 0;
}
if (a > b)
swap(a, b);
int i = 1, ans = 0;
while (1)
{
int d = i * i;
if (d > a + b)
break;
if (a >= d / 2)
ans
= i;
i
++;
}
printf(
"%d\n", ans);
return 0;
}

原文地址:https://www.cnblogs.com/rainydays/p/2101764.html