http://codeforces.com/contest/56

A

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 #define lson l,mid,rt<<1
 4 #define rson mid+1,r,rt<<1|1
 5 #define sqr(x) ((x)*(x))
 6 #define pb push_back
 7 #define eb emplace_back
 8 #define maxn 1000005
 9 #define rep(k,i,j) for(int k=i;k<j;k++)
10 typedef long long ll;
11 typedef unsigned long long ull;
12 
13 
14 int n;
15 
16 int main(){
17     #ifndef ONLINE_JUDGE
18         freopen("input.txt","r",stdin);
19     #endif
20     std::ios::sync_with_stdio(false);
21     cin>>n;
22     map<string,int>mp;
23     mp["ABSINTH"]++;
24     mp["BEER"]++;
25     mp["BRANDY"]++;
26     mp["CHAMPAGNE"]++;
27     mp["GIN"]++;
28     mp["RUM"]++;
29     mp["SAKE"]++;
30     mp["TEQUILA"]++;
31     mp["VODKA"]++;
32     mp["WHISKEY"]++;
33     mp["WINE"]++;
34     string str;
35     int ans=0;
36     for(int i=1;i<=n;i++){
37         cin>>str;
38         int tmp=0;
39         if(str[0]>='0'&&str[0]<='9'){
40             for(int j=0;j<str.length();j++){
41                 tmp=tmp*10+str[j]-'0';
42             }
43             if(tmp<18) ans++;
44         }
45         else{
46             if(mp[str]) ans++;
47         }
48     }
49     cout<<ans<<endl;
50 }
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-02
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案