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

注意这道题目在两个数相等时候的情况还是需要再判断

Posted by i_love_c at 2008-01-27 21:28:21 on Problem 2348
如果a 是 b的两倍 或者相等的情况毫无疑问是先取先赢 但是如果是a / b == 1 的情况就不一样了 还需要再判断
while ( a / b == 1 ) {
   win++;
   int c = a;
   a = b;
   b = c % b;
   if ( b == 0 ) break;
}
接着如果又是a 是 b的两倍就可以判断出来了 或者 b == 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