shunfurh 于 2017.09.14 21:24 提问

Tanning Salon

Tan Your Hide, Inc., owns several coin-operated tanning salons. Research has shown that if a customer arrives and there are no beds available, the customer will turn around and leave, thus costing the company a sale. Your task is to write a program that tells the company how many customers left without tanning.
The input consists of data for one or more salons, followed by a line containing the number 0 that signals the end of the input. Data for each salon is a single line containing a positive integer, representing the number of tanning beds in the salon, followed by a space, followed by a sequence of uppercase letters. Letters in the sequence occur in pairs. The first occurrence indicates the arrival of a customer, the second indicates the departure of that same customer. No letter will occur in more than one pair. Customers who leave without tanning always depart before customers who are currently tanning. There are at most 20 beds per salon.

For each salon, output a sentence telling how many customers, if any, walked away. Use the exact format shown below.

Sample Input

2 ABBAJJKZKZ
3 GACCBDDBAGEE
3 GACCBGDDBAEE
1 ABCBCA
0

Sample Output

All customers tanned successfully.
1 customer(s) walked away.
All customers tanned successfully.
2 customer(s) walked away.

1个回答

shen_wei      2017.09.15 16:55

POJ 1250 Tanning Salon（我的水题之路——字母表数组标记）
Tanning Salon Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5475   Accepted: 2994 Description Tan Your Hide, Inc., owns several coin-operated tanning sal
POJ1250：Tanning Salon
Description Tan Your Hide, Inc., owns several coin-operated tanning salons. Research has shown that if a customer arrives and there are no beds available, the customer will turn around and leave, thu
【队列】poj1250 Tanning Salon

Tanning Salon
Tanning Salon 时间限制(普通/Java):3000MS/10000MS          运行内存限制:65536KByte 总提交:25            测试通过:17 描述 Tan Your Hide, Inc., owns several coin-operated tanning salons. Research has shown that if
ZOJ 1405 Tanning Salon
<br />#include <stdio.h> #include <string.h> #define EMPTY '2' char bed[25]; char a[2000]; int k,j; int i,n; char c; char bad_luck[200]; int leave() { for (i=0;i<n;i++) if (a[k] == bed[i]) { bed[i] = EMPTY; r

poj 1250(Tanning Salon)

poj1250 Tanning Salon
#include #include void main(){ int n; char s[53],c[26]; int i,l,count,leave; scanf("%d",&n); while(n != 0 && n<=20){ memset(s,'\0',sizeof(s)); memset(c,'0',sizeof(c)); scanf("%s",s); l=s
1250 Tanning Salon
Description Tan Your Hide, Inc., owns several coin-operated tanning salons. Research has shown that if a customer arrives and there are no beds available, the customer will turn around and leave, t
POJ - 1250 Tanning Salon