Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

set

Posted by 2004140022 at 2015-10-13 13:51:08 on Problem 1250
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator