UVa 402.cpp


 * 1) include
 * 2) include 
 * 3) include 


 * 1) define CardCount 20
 * 2) define ListL 50000
 * 3) define PeopleNum 50

using namespace std;

void DebugPrint(int* p,int n) { for(int i=0;i0) Count++; //   cout<0) Find++; if(Find==CardNum) {           PeopleList[i] = -1; Find = 0; }        if(X==PeopleCount(PeopleList,N)) return PeopleList; }   return PeopleList; }

void PrintResult(int* PeopleListList) {   FILE *fp; fp = fopen("c:\\data.txt","w"); int Count = 1; for(int i=0;i0&&c==0) {               cout<0&&c!=0) {               cout<<" "<>N>>X) {                  if(N==0||X==0) break; for(int i=0;i>Card[i]; }     int* PeopleList = InitalArray(N,1);//人員列表 if(N!=X) {         for(int i=0;i<CardCount;i++) {            PeopleList = UnLuckyKick(PeopleList,N,X,Card[i]); if(X==PeopleCount(PeopleList,N)) break; }     }      //*存入PeopleListList for(int i=0;i<ListL;i+=PeopleNum) {        if(PeopleListList[i]==-2) {            for(int j=0;j<N;j++) {                PeopleListList[i+j] = PeopleList[j]; }              break; //跑完一輪 就跳出 }     } //      DebugPrint(PeopleListList,ListL); } PrintResult(PeopleListList); system("PAUSE"); return 0; }