UVALive 5797 In Braille
题意:给出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的更多相关文章
- UVALive - 4108 SKYLINE[线段树]
UVALive - 4108 SKYLINE Time Limit: 3000MS 64bit IO Format: %lld & %llu Submit Status uDebug ...
- UVALive - 3942 Remember the Word[树状数组]
UVALive - 3942 Remember the Word A potentiometer, or potmeter for short, is an electronic device wit ...
- UVALive - 3942 Remember the Word[Trie DP]
UVALive - 3942 Remember the Word Neal is very curious about combinatorial problems, and now here com ...
- 思维 UVALive 3708 Graveyard
题目传送门 /* 题意:本来有n个雕塑,等间距的分布在圆周上,现在多了m个雕塑,问一共要移动多少距离: 思维题:认为一个雕塑不动,视为坐标0,其他点向最近的点移动,四舍五入判断,比例最后乘会10000 ...
- UVALive 6145 Version Controlled IDE(可持久化treap、rope)
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...
- UVALive 6508 Permutation Graphs
Permutation Graphs Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit ...
- UVALive 6500 Boxes
Boxes Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Pract ...
- UVALive 6948 Jokewithpermutation dfs
题目链接:UVALive 6948 Jokewithpermutation 题意:给一串数字序列,没有空格,拆成从1到N的连续数列. dfs. 可以计算出N的值,也可以直接检验当前数组是否合法. # ...
- 【暑假】[实用数据结构]UVAlive 3135 Argus
UVAlive 3135 Argus Argus Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %l ...
随机推荐
- 高性能Mysql主从架构的复制原理及配置详解(转)
温习<高性能MySQL>的复制篇. 1 复制概述 Mysql内建的复制功能是构建大型,高性能应用程序的基础.将Mysql的数据分布到多个系统上去,这种分布的机制,是通过将Mysql的某一台 ...
- HDU 1720 A+B Coming
#include <string> #include <cstdio> #include <iostream> using namespace std; int c ...
- hive 0.10 0.11新增特性综述
我们的hive版本升迁经历了0.7.1 -> 0.8.1 -> 0.9.0,并且线上shark所依赖的hive版本也停留在0.9.0上,在这些版本上有我们自己的bug fix patch和 ...
- Adobe Flash Player已经终止一项可能不安全的操作,解决方案
http://www.macromedia.com/support/documentation/cn/flashplayer/help/settings_manager04.html
- Java设计模式模式观测(Observer Pattern)
Observer Pattern 设计模式通常用于.这是一个事件侦听器模型. 该模型有两个作用,一个是Subject, 有一个Observer.Subject 保存多个Observer参考,一旦一个特 ...
- adb shell dumpsys 命令 查看内存
android程序内存被分为2部分:native和dalvik,dalvik就是我们平常说的java堆,我们创建的对象是在这里面分配的,而bitmap是直接在native上分配的,对于内存的限制是 n ...
- Jquery Select 下拉框处理
$("#select").empty();//清空 $("#select").append($("<option/>").val ...
- SQL Server(SSIS package) call .net DLL
There are two method to call .net DLL in SQLSERVER. The first one is to use the sql clr but it has a ...
- 【转】Ubuntu下deb包的安装方法
[转]Ubuntu下deb包的安装方法 deb是debian linus的安装格式,跟red hat的rpm非常相似,最基本的安装命令是:dpkg -i file.deb dpkg 是Debian P ...
- CodeForce 569A
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description Litt ...