博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj 1250 Tanning Salon
阅读量:4984 次
发布时间:2019-06-12

本文共 1748 字,大约阅读时间需要 5 分钟。

Tanning Salon
Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 5384   Accepted: 2943

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, thus costing the company a sale. Your task is to write a program that tells the company how many customers left without tanning.

Input

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.

Output

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

Sample Input

2 ABBAJJKZKZ3 GACCBDDBAGEE3 GACCBGDDBAEE1 ABCBCA0

Sample Output

All customers tanned successfully.1 customer(s) walked away.All customers tanned successfully.2 customer(s) walked away.
#include
using namespace std; int main() {
int n; char guest[200]; char bed[21]; int bed_left; int len; int i,j,k; int leave; while(1) {
cin>>n; if(n==0) break; cin>>guest; bed_left=n; leave=0; len=strlen(guest); for(i=0;i
 

转载于:https://www.cnblogs.com/w0w0/archive/2011/11/21/2256824.html

你可能感兴趣的文章
Maven学习笔记(一)
查看>>
分割线
查看>>
xls的读写
查看>>
用函数创建子进程
查看>>
Myeclipse配置插件
查看>>
gitlab配置通过smtp发送邮件(QQ exmail腾讯企业为例)
查看>>
蓝桥杯之入学考试
查看>>
新公司java的注解以及springboot的相关注解
查看>>
Unity脚本的生命周期中几个重要的方法
查看>>
poj1552
查看>>
Thinkphp中文水印和图片水印合体集成插件
查看>>
FLASK安装--兼收EZ_INSTALL及PIP
查看>>
C++静态成员变量和静态成员函数小结
查看>>
Python---Flask--02--模板
查看>>
PHP学习笔记---封装(面向对象三大特性之一)
查看>>
如何快速找到指定端口被哪个程序占用并释放该端口(解决bindException)
查看>>
迭代之while循环(1)
查看>>
final修饰的类有什么特点
查看>>
关于string类中find函数的讲解
查看>>
程序员的情书
查看>>