| ||||||||||
| 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 | |||||||||
水过,贴AC代码Source Code
Problem: 3543 User: caizixian
Memory: 164K Time: 79MS
Language: C++ Result: Accepted
* Source Code
#include<iostream>
using namespace std;
int a,b;
bool Judge(int l) {
int s1=l*l/2,s2=l*l-s1;
return (a>=s1 && b>=s2);
}
int main() {
scanf("%d%d",&a,&b);
if (a>b) swap(a,b);int l=0,r=b+1;while (l+1<r) {
int m=(l+r)/2;if (Judge(m)) l=m;
else r=m;
}
if (l) printf("%d\n",l);
else puts("Impossible");
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator