标签:
Description
Input
Output
Sample Input
4 2 3 2 3 5
Sample Output
1 none 3 4 5
和杭电2188差不多,都是差不多裸的巴什博奕,只不过这道题要求把加价输出。我按照三种情况来考虑:
1.如果n%(m+1)==0 那么lele处于必败的局面。
2.如果n>=m,则lele处于必胜的局面。此时输出结果可能为1个和多个。
3.如果n不是m+1的倍数,那么第一次取得值要为要为加价以后剩下的值%(n+1)==0,这样Yueyue再取的时候成了必败的一方。
#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;
}
标签:
原文地址:http://blog.csdn.net/u013486414/article/details/44224921