版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cugsl/article/details/82313605
这个题和HDU 2188题意是一样的,只是输出的时候不同,具体题意和分析见这里
注意这两个题的m,n的意义是相反的,这里统一用2188的
这个题要输出第一步出的价格,经过我们上面的分析,从n开始往下走每次减去m+1的时候都是必胜态,所以模拟一下会发现n%(m+1)得到的就是第一步走的必胜态,所以一定是这个。但是还有一点,如果n
#include <iostream>
using namespace std;
int main()
{
int n, m;
while (cin >> m >> n)
{
if (m % (n + 1) == 0) cout << "none" << endl;
else if (m <= n)
{
for (int i = m; i <= n; i++)
if (i != n) cout << i << " ";
else cout << i << endl;
}
else
{
cout << m % (n + 1) << endl;
}
}
return 0;
}