Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
请高手给几组测试数据,我的编译没有问题啊,为什么总是wrong answer?#include <iostream> using namespace std; struct tan { char data; int tanned; int unTanned; }; int main() { int count; char customers[100]; cin>>count; while(count != 0) { int i,j,nowCount=0,totalUnTanned = 0; tan *client[100]; cin>>customers; for(i = 0;customers[i] != '\0';i++) { int flag = 0,temp = 0; for(j = 0;j <= i - 1;j ++) { if(client[j] -> data == customers[i]) { flag = 1; temp = j; break; } else continue; } client[i] = new tan; if(nowCount < count && flag == 0) { client[i] -> data = customers[i]; client[i] -> tanned = 1; client[i] -> unTanned = 0; nowCount ++; } else if(nowCount <= count && flag == 1) { client[i] -> data = 'a'; client[temp] -> data = 'a'; client[i] -> unTanned = 0; if(nowCount == 0) { nowCount = 0; } else nowCount --; } else if(nowCount == count && flag == 0) { client[i] -> data = customers[i]; client[i] -> unTanned = 1; } } for(j = 0;j < i;j ++) { if(client[j] -> unTanned == 1) { totalUnTanned ++; } } if(totalUnTanned == 0) { cout<<"All customers tanned successfully."<<endl; } else { cout<<totalUnTanned<<" customer(s) walked away."<<endl; } cin>>count; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator