• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
HaibaraAi
博客园    首页    新随笔    联系   管理    订阅  订阅

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 }
View Code 2013-10-14 14:42:18

 

posted @ 2013-10-14 14:40  HaibaraAi  阅读(198)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3