题目

比赛总结

题意:给出1-9的盲文,每种盲文都是2×3的点阵,有些点是凸起的用*表示,其余的用.表示。要进行两种操作,1 把盲文变成数字,2 把数字变成盲文

解法:按规则模拟。。。。注意读入的每个盲文之间有空格隔开,如果用gets读要消息空格和换行

//time 3ms
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
const int MAXN = 5005;
using namespace std;
char str[10][10]={"011100","100000","101000","110000","110100","100100","111000","111100","101100","011000"};
char st[MAXN][10];
int main()
{
//freopen("/home/moor/Code/input","r",stdin);
int n;
char a[MAXN],op[5]; while(scanf("%d",&n)&&n)
{
scanf("%s",op);
if(op[0]=='S')
{
scanf("%s",a);
for(int i = 0; i < 3; i++)
{
for(int j = 0; a[j]; j++)
{
int p=a[j]-'0';
if(str[p][i*2]=='1') printf("*");
else printf(".");
if(str[p][i*2+1]=='1') printf("*");
else printf(".");
if(j!=(int)strlen(a)-1)
printf(" ");
}
printf("\n");
} }
else
{
for(int i = 0; i < 3; i++)
{
a[0]='\0';
while(a[0]=='\0') gets(a);
for(int j = 0,k=0; a[j]; j+=3,k++)
{ if(a[j]=='*') st[k][i*2]='1';
else st[k][i*2]='0';
if(a[j+1]=='*') st[k][i*2+1]='1';
else st[k][i*2+1]='0';
}
}
for(int i = 0; i < n; i++)
{
st[i][6]='\0';
for(int j = 0; j < 10; j++)
{
if(strcmp(str[j],st[i])==0)
{
printf("%d",j);
break;
}
}
}
printf("\n");
}
}
return 0;
}

UVALive 5797 In Braille的更多相关文章

  1. UVALive - 4108 SKYLINE[线段树]

    UVALive - 4108 SKYLINE Time Limit: 3000MS     64bit IO Format: %lld & %llu Submit Status uDebug ...

  2. UVALive - 3942 Remember the Word[树状数组]

    UVALive - 3942 Remember the Word A potentiometer, or potmeter for short, is an electronic device wit ...

  3. UVALive - 3942 Remember the Word[Trie DP]

    UVALive - 3942 Remember the Word Neal is very curious about combinatorial problems, and now here com ...

  4. 思维 UVALive 3708 Graveyard

    题目传送门 /* 题意:本来有n个雕塑,等间距的分布在圆周上,现在多了m个雕塑,问一共要移动多少距离: 思维题:认为一个雕塑不动,视为坐标0,其他点向最近的点移动,四舍五入判断,比例最后乘会10000 ...

  5. UVALive 6145 Version Controlled IDE(可持久化treap、rope)

    题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...

  6. UVALive 6508 Permutation Graphs

    Permutation Graphs Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit ...

  7. UVALive 6500 Boxes

    Boxes Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Pract ...

  8. UVALive 6948 Jokewithpermutation dfs

    题目链接:UVALive 6948  Jokewithpermutation 题意:给一串数字序列,没有空格,拆成从1到N的连续数列. dfs. 可以计算出N的值,也可以直接检验当前数组是否合法. # ...

  9. 【暑假】[实用数据结构]UVAlive 3135 Argus

    UVAlive 3135 Argus Argus Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %l ...

随机推荐

  1. live555学习经验链接一

    live555学习经验链接:http://xingyunbaijunwei.blog.163.com/blog/#m=0&t=1&c=fks_084071082087086069082 ...

  2. BZOJ 1672: [Usaco2005 Dec]Cleaning Shifts 清理牛棚

    题目 1672: [Usaco2005 Dec]Cleaning Shifts 清理牛棚 Time Limit: 5 Sec  Memory Limit: 64 MB Description Farm ...

  3. JS获取整个HTML网页代码 - Android 集美软件园 - 博客频道 - CSDN.NET

    JS获取整个HTML网页代码 - Android 集美软件园 - 博客频道 - CSDN.NET JS获取整个HTML网页代码 分类: Android提高 2012-01-12 23:27 1974人 ...

  4. 邮件发送 emailsend .net开发

    protected void Button1_Click(object sender, EventArgs e) { MailSender.Send("lizihong3@163.com&q ...

  5. TreeView控件绑定数据库

    1.在设计视图里面的代码 <form id="form1" runat="server"> <div> <h1>两个表< ...

  6. 「OC」 多态

    一.基本概念 多态在代码中的体现,即为某一类事物的多种形态,OC对象具有多态性.必须要有继承,没有继承就没有多态. 在使用多态时,会进行动态检测,以调用真实的对象方法. 多态在代码中的体现即父类指针指 ...

  7. select into from 和 insert into select 的用法和区别(转)

    转自:http://www.studyofnet.com/news/182.html select into from 和 insert into select都是用来复制表,两者的主要区别为: se ...

  8. python成长之路16

    阅读(72) 一:jQuery是一个兼容多浏览器的javascript类库,核心理念是write less,do more(写得更少,做得更多),对javascript进行了封装,是的更加便捷的开发, ...

  9. r语言之生成随机序列,随机数生成函数及用法

    (1)生成正态分布随机数: rnorm(n,mean,sd)     其中,n表示生成的随机数个数,mean表示正态分布均值,sd表示正态分布标准差 > rnorm(5,0,2)[1] -5.3 ...

  10. 部署django - Apache + mod_wsgi + windows

    部署django - Apache + mod_wsgi + windows 1.环境 django 1.6.2 python 3.3 32位 apache 2.4.7 32位 一个可以使用的djan ...