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 ...
随机推荐
- Qt之美(一):d指针/p指针详解
Translated by mznewfacer 2011.11.16 首先,看了Xizhi Zhu 的这篇Qt之美(一):D指针/私有实现,对于很多批评不美的同路人,暂且不去评论,只是想支持 ...
- AndroidStudio项目移植到Eclipse
原文件结构: 在AndroidStudio中 main目录对应eclipse中的src目录 可以看看每个文件夹下的目录 没有src或者main这些文件夹的都可以删掉 我这里只有app下的东西是需要留着 ...
- jQuery EasyUI 数字框(NumberBox)用法
这里的options是选项,可以参考下表: 选项名 类型 描述 默认值 min 数字 文本框中可允许的最小值 null max 数字 文本框中可允许的最大值 null precision 数字 最高可 ...
- STL之string插入
#include <iostream> #include <string> using namespace std; int main() { string s("h ...
- c#程序将excel文件转换成xml文件
要程序你自己去组装去,我只写两个部分,一个是读Excel的部分,然后是写入到xml的1) 从指定的excel读出信息string strConn="provider=Microsoft.Je ...
- Js 返回页面 or 跳转页面
跳出 iframe 在当前页跳转, window.parent.frames.location.href=www.baidu.com" 跳转页面 onclick="history. ...
- 改变status bar的状态
两种改变status bar状态的方法 一 :(全局的) 直接在当前控制器中(一般是在navigationcontroller) //- (UIStatusBarStyle)preferredStat ...
- sdl2-2.04 读取位图并显示
// sdl2_win32.cpp : Defines the entry point for the console application.//// 假定SDL的库文件和头文件和VC的工程文件在一 ...
- BZOJ 1609: [Usaco2008 Feb]Eating Together麻烦的聚餐( LIS )
求LIS , 然后用 n 减去即为answer ---------------------------------------------------------------------------- ...
- 数据表转换成json(DatatableToJson)
#region 转换Table为JSON数据 /// <summary> /// 转换Table为JSON数据 /// </summary> /// <param nam ...