HDU 1525 Euclid's Game)

Source: Internet
Author: User

Two numbers a and B always have a situation of B, a % B, which is inevitable. If a> = B & a <2 * B, then there is only one case, directly to B, a % B. Otherwise, there are multiple cases.
For a/B = 1, only B, a % B can be selected. If a/B> = 2, you can first select who will face the situation like B and a % B.
Obviously, players are smart enough. B. It is clear who wins and loses B. First-hand players must win in a/B> = 2.
[Cpp]
# Include <iostream>
# Include <cstdio>
# Include <cstring>
# Include <algorithm>
# Include <cmath>
# Include <vector>
# Include <string>
# Include <map>
# Define LL long
# Define N 1000000
# Define inf 1 <20
Using namespace std;
Int main (){
Int a, B;
While (scanf ("% d", & a, & B )! = EOF & a + B ){
If (a <B)
Swap (a, B );
Bool stan = true;
While (1 ){
If (B = 0 | a % B = 0 | a/B> = 2) break;
Int t =;
A = B;
B = t-;
Stan =! Stan;
}
If (stan)
Printf ("Stan wins \ n ");
Else www.2cto.com
Printf ("Ollie wins \ n ");
}
Return 0;
}


By ACM_cxlove

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.