HDU 2149-public Sale (Bashbor Wilson)

Source: Internet
Author: User

Public SaleTime limit:MS Memory Limit:32768KB 64bit IO Format:%i64d &%i64u SubmitStatusPracticeHDU 2149Appoint Description:System Crawler (2015-03-07)

Description

Although I do not want to, but the reality is always reality, Lele never escaped the fate of withdrawal, because he did not get scholarships. What awaits him now is a field career like Farmjohn.

To farm to have a field to do, Lele heard that the street is holding a spectacular auction, the auction of goods is just a piece of 20 acres of field. So Lele took all his savings and rushed to the auction.

Later found that the entire auction will be only Lele and his dead rival Yueyue.

By asking, Lele know the rules of the auction is this: the initial reserve price of 0, two people take turns to start the fare increase, but each increase in the range between 1~n, when the price is greater than or equal to the cost of the field M, the organizer will sell this field to the price of the person.

Lele and Yueyue Although the exam is not good, but the auction is very proficient, and they are two people are very much want this field. So they always choose the most advantageous way for them to make the fare increase.

Because Lele dictionary order than Yueyue front, so each time is lele first start fare increase, excuse me, the first time,
How much does Lele want to make sure he can get the land?

Input

This topic contains multiple sets of tests, please process to end of file (EOF). Each group of tests takes one row.
Each set of tests contains two integers M and N (meaning see topic Description, 0<N,M<1100)

Output

For each set of data, in a row in ascending order output Lele The first time the price can be added. Two data is separated by a space.
If Lele is unable to buy the land for the first time in any bid, it will output "none".

Sample Input

Sample Output


and Hangzhou electric 2188 Almost, are almost naked Bashbor game, but this problem requires the increase in output. I think in three different situations:

1. If n% (m+1) ==0 then Lele in a losing situation.

2. If n>=m, then Lele is in a winning situation. The output may be 1 and more at this time.

3. If n is not a multiple of m+1, then the first time to get the value for the remaining value after the increase (n+1) ==0, so that the Yueyue to take the time to become a defeated party.

#include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #include < iostream> #include <algorithm> #include <set> #include <queue> #include <stack> #include < Map>using namespace Std;int Main () {    int m,n,i;    int cnt;    while (~SCANF ("%d%d", &m,&n)) {        cnt=0;        if (m% (n+1) ==0) {            printf ("none\n");            Continue;        }        if (m<=n) {            for (i=m; i<n; i++)                printf ("%d", I);            printf ("%d\n", I);        } else {            cnt=0;            for (i=m; i>=1; i--) {                if (i% (n+1) ==0) {                    printf ("%d\n", CNT);                    break;                }                cnt++    ;    }}} return 0;}


HDU 2149-public Sale (Bashbor Wilson)

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.