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

水过,贴AC代码

Posted by caizixian at 2010-02-15 10:08:30 on Problem 3543
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:
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