标签:
才直到这种问题叫巴什博奕
换是老问题
多了一个第一次报价的输出取值
我分了两种情况
1.N》=M时 ,应该是输出M,M+1,...N
2.N<M时,输出s,s+N+1,...<=M
(s来源于公式M%(N+1) == s)
#include<cstdio> int main() { int M,N; while(scanf("%d%d",&M,&N)!=EOF){ if(M%(N+1)==0) printf("none\n"); else { int minn = M%(N+1) ; printf("%d",minn); if(minn) if(minn == M) for(int i=1;i+minn<=N;i++) printf(" %d",i+minn); else for(int i=N+1;i+minn<=N;i+=(N+1)) printf(" %d",i+minn); printf("\n"); } } return 0; } //10 2 //3 3 1
标签:
原文地址:http://blog.csdn.net/a197p/article/details/46334621