poj 1250

        本来用cin cout输入输出,可不知道怎么弄得cin was not declared in this scorpe,怎么调都不行,郁闷...

#include<iostream>
#include
<cstdio>
#include
<cstring>
int main(){
    
int n, d ;
    
char a[100] ;
    
bool v[100], e[100] ;
    
while(scanf("%d"&n)!=EOF&&n){
        scanf(
"%s"&a) ;
        
int b=0 ;
        memset(v,
0,sizeof(v)) ;
        memset(e,
0,sizeof(e)) ;
        
for(int i=0; i<strlen(a); i++){
            d 
= a[i]-'A' ;
            
if(!v[d]){
                v[d] 
= true ;
                
if(n>0){
                    n 
-- ;
                    e[d] 
= true ;
                }
                
else b++ ;
            }
            
else if(e[d]) n ++ ;
        }
        
if(b==0)
            printf(
"All customers tanned successfully.\n") ;
        
else
            printf(
"%d customer(s) walked away.\n", b) ;
        }
    
return 0 ;
}
原文地址:https://www.cnblogs.com/xiaolongchase/p/2175340.html