Uva 省赛傻逼题 C
呵呵居然怕字符串不做,有好有坏!
Problem C
Time limit: 1.000 seconds
Character Recognition?
Write a program that recognizes characters. Don't worry, because you only need to recognize three digits: 1, 2 and 3. Here they are:
.*. *** *** .*. ..* ..* .*. *** *** .*. *.. ..* .*. *** ***
Input
The input contains only one test case, consisting of 6 lines. The first line contains n, the number of characters to recognize (1<=n<=10). Each of the next 5 lines contains 4n characters. Each character contains exactly 5 rows and 3 columns of characters followed by an empty column (filled with '.').
Output
The output should contain exactly one line, the recognized digits in one line.
Sample Input
3 .*..***.***. .*....*...*. .*..***.***. .*..*.....*. .*..***.***.
Output for the Sample Input
123
The Ninth Hunan Collegiate Programming Contest (2013)
Problemsetter: Rujia Liu
Special Thanks: Feng Chen, Md. Mahbubul Hasan
 
1 #include <map> 2 #include <string> 3 #include <cstdio> 4 #include <cstring> 5 #include <iostream> 6 #include <algorithm> 7 using namespace std; 8 #define maxn 1111 9 #define ll long long 10 int n,m; 11 int ans[maxn]; 12 char s[maxn]; 13 int main(){ 14 while(~scanf("%d",&n)){ 15 for(int i=0;i<3;i++)scanf("%s",s); 16 scanf("%s",s); 17 for(int i=0;i<4*n;i+=4){ 18 if(s[i+1]=='*')ans[i/4]=1; 19 if(s[i]=='*')ans[i/4]=2; 20 if(s[i+2]=='*')ans[i/4]=3; 21 } 22 scanf("%s",s); 23 for(int i=0;i<n;i++)printf("%d",ans[i]); 24 printf("\n"); 25 } 26 return 0; 27 }
 
                    
                 
 
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号