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 |
set#include<iostream> #include<stdio.h> #include<math.h> #include<stdlib.h> #include<string> #include<string.h> #include<set> #include<algorithm> using namespace std; set<char>p,q; int main() { int n,i; string s; while(1) { p.clear(); q.clear(); scanf("%d",&n); if(!n)break; cin>>s; for(i=0;i<s.length();i++) { if(p.find(s[i])!=p.end()) p.erase(s[i]); else{ if(p.size()<n) p.insert(s[i]); else q.insert(s[i]); } } if(q.size()==0) puts("All customers tanned successfully."); else printf("%d customer(s) walked away.\n",q.size()); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator