poj1250 Tanning Salon
2013-10-19 10:30
260 查看
#include<stdio.h> #include<string.h> 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=strlen(s); count=0; leave=0; for(i=0;i<l;i++){ if(count >= n){ if(c[s[i]-65] == '0'){ c[s[i]-65]='2'; leave++; continue; } else if(c[s[i]-65]=='2'){ continue; } } if(c[s[i]-65] == '0'){ c[s[i]-65] = '1'; count++; } else if(c[s[i]-65] == '1'){ c[s[i]-65] = '0'; count--; } } if(leave == 0) printf("All customers tanned successfully.\n"); else printf("%d customer(s) walked away.\n",leave); scanf("%d",&n); } }
相关文章推荐
- POJ 1250 Tanning Salon
- POJ 1250 Tanning Salon(我的水题之路——字母表数组标记)
- POJ 1250 Tanning Salon
- POJ 1250 Tanning Salon
- poj 1250 Tanning Salon
- POJ1250 Tanning Salon 简单模拟
- poj 1250 Tanning Salon(模拟)
- POJ 1250 Tanning Salon
- poj 1250 Tanning Salon
- poj1250 Tanning Salon
- poj 1250 Tanning Salon 【模拟题】
- poj 1250 Tanning Salon
- POJ 1250 Tanning Salon(简单模拟)
- poj 1250 Tanning Salon
- POJ 题目1250 Tanning Salon (链表应用)
- POJ-1250-Tanning Salon
- poj 1250(Tanning Salon)
- POJ1250:Tanning Salon
- POJ - 1250 Tanning Salon
- poj 1250 Tanning Salon