求大佬们帮看看提交到NOJ上PE的问题
如题程序代码:
#include <stdio.h> #include <stdlib.h> int main() { int n,x,i,j,k,card[21],num[51],sum; scanf("%d%d",&n,&x); for (i=1;i<=20;i++) { scanf("%d",&card[i]); } for (i=1;i<=n;i++) { num[i]=i; } i=1; sum=50; while (sum>x) { sum=0; k=1; for (j=1;j<=n;j++) { if (num[j]%card[i]!=0) { num[j]=k; k++; } else { num[j]=0; } } for (j=1;j<=n;j++) { if (num[j]>0)sum++; } i++; } for (j=1;j<=n;j++) { if (num[j]==x) { printf("%d",j); return 0; } if (num[j]>0) { printf("%d ",j); } } return 0; }