Loading

HDU-2149 Public Sale

Public Sale

巴什博奕

这题的分析同 HDU-2188,我的题解:https://www.cnblogs.com/dgsvygd/p/16268092.html

注意如果 \(N > M\) 的情况下,要从小到大地输出所有答案

#include <iostream>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    while(cin >> n >> m)
    {
        if(n <= m)
        {
            int cur = 0;
            for(int i=n; i<=m; i++)
            {
                if(cur++) cout << " ";
                cout << i;
            }
            cout << endl;
        }
        else if(n % (m + 1) == 0)
            cout << "none" << endl;
        else
            cout << n % (m + 1) << endl;
    }
    return 0;
}
posted @ 2022-05-13 20:56  dgsvygd  阅读(27)  评论(0编辑  收藏  举报