1679 stone game

Source: Internet
Author: User

Description

One day, TT was bored in the dormitory, and he played a stone game with his colleagues. However, due to limited conditions, he/they used wangzi's steamed buns As stones. The rules of the game are as follows. There is a pile of stones, the number is n (1 <= n <= 109), two people take several of them in turn, each time a maximum of M (1 <= m <= 104), the first to win the stone. We know that TT and his/her roommates are both very smart. If TT is used first, will he/she win the game?

Input

The input contains less than 10000 groups of data. Each group contains one row of data. There are two numbers N and M, separated by spaces.

Output

Output a row for each group of data. If the first TT can win the game, "win" is output; otherwise, "lose" is output (no quotation marks are required)

Solution: This is a mathematical problem. You only need to find the rule. The judgment rule is the remainder of n divided by m + 1, but it does not prove.

 

# Include <iostream> using namespace STD; int main () {int A, B; while (CIN> A> B) {if (a % (B + 1 )! = 0) cout <"win" <Endl; else cout <"lose" <Endl ;}return 0 ;}

 

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.