gym-101343D-Husam's Bug

Posted Kearon

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了gym-101343D-Husam's Bug相关的知识,希望对你有一定的参考价值。

 1 ///水题
 2 #include<bits/stdc++.h>
 3 using namespace std;
 4 int main()
 5 {
 6     int n;
 7     while(~scanf("%d",&n))
 8     {
 9         char s[110];
10         while(n--)
11         {
12             scanf("%s",s);
13             int len=strlen(s);
14             int flag[3]={0};
15             for(int i=0;i<len;i++)
16             {
17                 if(s[i]>=a&&s[i]<=z||s[i]>=A&&s[i]<=Z)
18                     flag[0]++;
19                 if(s[i]>=0&&s[i]<=9)
20                     flag[1]++;
21                 if(s[i]==@||s[i]==?||s[i]==!)
22                     flag[2]++;
23             }
24             if(flag[0]<4)
25                 printf("The last character must be a letter.\n");
26             else if(flag[1]<4)
27                 printf("The last character must be a digit.\n");
28             else if(flag[2]<2)
29                 printf("The last character must be a symbol.\n");
30             else
31                 printf("The last character can be any type.\n");
32         }
33     }
34 }

 

以上是关于gym-101343D-Husam's Bug的主要内容,如果未能解决你的问题,请参考以下文章

gym-101343E-Abdalrahman Ali Bugs

gym-101343K-Counting Time

gym-101343H-Give Me This Pizza

gym-101343I-Husam and the Broken Present 1

Mother's Milk

Python,如何去掉字符串 s = 'values ( e , b )'中,括号里面的空格?