HDU 1527 stone game (naked weizov game)

Source: Internet
Author: User
/* There are two piles of stones. The quantity can be any different. The game started with taking stones in turn by two people. The game stipulates that there are two different methods to get each time. One is to take any pile of stones and the other is to take the same number of stones at the same time. Finally, the winner of all the stones */# include <stdio. h> # include <string. h> # include <algorithm> # include <iostream> # include <math. h> using namespace STD; int main () {int A, B, K; while (~ Scanf ("% d", & A, & B) {If (A> B) Swap (a, B); int K = B-; k = K * (SQRT (5.0) + 1)/2; If (k = A) // K equals to a smaller heap, the latter wins printf ("0 \ n"); else printf ("1 \ n");} return 0 ;}

HDU 1527 stone game (naked weizov game)

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.