Description

A friend of you has just bought a new computer. Until now, the most powerful computer he ever used has been a pocket calculator. Now, looking at his new computer, he is a bit disappointed, because he liked the LC-display of his calculator so much. So you decide to write a program that displays numbers in an LC-display-like style on his computer.

Input

The input contains several lines, one for each number to be displayed. Each line contains two integers s, n (1 <= s <= 10, 0 <= n <= 99 999 999), where n is the number to be displayed and s is the size in which it shall be displayed.

The input file will be terminated by a line containing two zeros. This line should not be processed.

Output

Output the numbers given in the input file in an LC-display-style using s "-" signs for the horizontal segments and s "|" signs for the vertical ones. Each digit occupies exactly s+2 columns and 2s+3 rows. (Be sure to fill all the white space occupied by the digits with blanks, also for the last digit.) There has to be exactly one column of blanks between two digits.

Output a blank line after each number. (You will find a sample of each digit in the sample output.)

Sample Input

2 12345
3 67890
0 0

Sample Output

      --   --        --
| | | | | |
| | | | | |
-- -- -- --
| | | | |
| | | | |
-- -- -- --- --- --- --- ---
| | | | | | | |
| | | | | | | |
| | | | | | | |
--- --- ---
| | | | | | | |
| | | | | | | |
| | | | | | | |
--- --- --- ---

Source

 
看看sample input和sample output就知道它让你干嘛了……所以一行行暴力一点的输出就好
 #include<stdio.h>
#include<string.h>
void row_0(int n){int i;for(i=;i<=n+;i++) printf(" ");}
void row_1(int n){int i;printf(" ");for(i=;i<=n;i++) printf("-");printf(" ");}
void col_l(int n){int i;printf("|");for(i=;i<=n+;i++) printf(" ");}
void col_r(int n){int i;for(i=;i<=n+;i++) printf(" ");printf("|");}
void col_b(int n){int i;printf("|");for(i=;i<=n;i++) printf(" ");printf("|");}
void display(int num[],int n)
{
int r,c,i;
for(r=;r<=*n+;r++){
//输出三个衡横行
if((r-)%(n+)==)
for(c=;num[c]>=;c++){
if(num[c]== || num[c]== || num[c]== || num[c]== || num[c]== || num[c]==) row_1(n);
if(num[c]==) for(i=;i<=n+;i++) printf(" ");
if(num[c]==){
if((r-)/(n+)==) row_1(n);
else row_0(n);
}
if(num[c]==){
if((r-)/(n+)==) row_1(n);
else row_0(n);
}
if(num[c]==){
if((r-)/(n+)==) row_0(n);
else row_1(n);
}
printf(" ");
}
//输出上竖行
if(r> && r<n+)
for(c=;num[c]>=;c++){
if(num[c]== || num[c]==) col_l(n);
if(num[c]== || num[c]== || num[c]== || num[c]==) col_r(n);
if(num[c]== || num[c]== || num[c]== || num[c]==) col_b(n);
printf(" ");
}
//输出下竖行
if(r>n+ && r<*n+)
for(c=;num[c]>=;c++){
if(num[c]==) col_l(n);
else if(num[c]== || num[c]== || num[c]==) col_b(n);
else col_r(n);
printf(" ");
} printf("\n");
}
}
int main()
{
int i,n,num[];char temp[];
while( scanf("%d %s",&n,&temp) && n!= ){
memset(num,-,sizeof(num));
for(i=;temp[i];i++){
num[i]=temp[i]-'';
}
display(num,n);
if(n!=) printf("\n");
}
}

POJ 1102 - LC-Display的更多相关文章

  1. poj 1102.LC-Display 解题报告

    题目链接:http://poj.org/problem?id=1102 题目意思:就是根据给出的格式 s 和 数字 n,输出数值 n 的 LCD 显示.数值 n 的每个数字要占据 s + 2 列 和 ...

  2. POJ 1102

    #include<iostream>// cheng da cai zi 11.14 using namespace std; int main() { int i; int j; int ...

  3. 设备管理 USB ID

    发现个USB ID站点,对于做设备管理识别的小伙伴特别实用 http://www.linux-usb.org/usb.ids 附录: # # List of USB ID's # # Maintain ...

  4. 类声明、类作用域、前向声明、this指针、嵌套类、PIMPL 技法 等

    一.类声明 //类是一种用户自定义类型,声明形式: class 类名称 {    public:              公有成员(外部接口)    private:              私有 ...

  5. 2019nc#4

    题号 标题 已通过代码 题解 通过率 团队的状态 A meeting 点击查看 树直径 604/2055   B xor 点击查看 线段树维护线性基交 81/861 未通过 C sequence 点击 ...

  6. Treap + 无旋转Treap 学习笔记

    普通的Treap模板 今天自己实现成功 /* * @Author: chenkexing * @Date: 2019-08-02 20:30:39 * @Last Modified by: chenk ...

  7. SAP T CODE : Description (Program)

    SAP T CODE : Description (Program) V : Quickstart RKCOWUSL (RKCOWUSL)V+01 : Create Sales Call (SAPMV ...

  8. POJ题目细究

    acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  102 ...

  9. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

随机推荐

  1. arcgis server瓦片行列号计算

    2013-08-01 arcgis server切图时会设置一个原点坐标,如果是经纬度坐标一般默认(x0,y0)=(-400,400)作为切图的起始点,即从这开始算行列号.假设切图的地图某点坐标为x, ...

  2. s:if 标签 字符串比较 正确用法和错误用法

    transaction.tjpopState 该对象在后台是枚举类型,在前台需要转为字符串才能比较. 错误一: <s:if test='transaction.tjpopState!=" ...

  3. [svc]arp协议的细枝末节

    tcpdump抓取arp包 tcpdump -nn -i calif24874aae57 -e arp数据包格式 操作字段指出四种操作类型: arp请求 1 arp应答 2 rarp请求 3 rarp ...

  4. 【Android】Android开源项目精选(一)

    ListView ListView下拉刷新:https://github.com/johannilsson/android-pulltorefresh AndroidPullToRefresh:htt ...

  5. 【MongoDB】MongoDb的“not master and slaveok=false”错误及解决方法 mongo连接从库出现问题

    链接mongodb报错如下 2016-03-14T16:26:00.912+0800 E QUERY [thread1] Error: listDatabases failed:{ "ok& ...

  6. Error:java: invalid source release 无效的源发行版: 8

    原因:这是由于jdk的版本与项目的要求不一致造成的,如果是maven项目,首先查看一下pom.xml,以我的项目为例: 从其中可以看出要求的编译插件为1.8版本,而我本机上安装的jdk为1.7版本,因 ...

  7. sql操作总结

    SQL 语句的多表查询方式例如:按照 department_id 查询 employees(员工表)和 departments(部门表)的信息.方式一(通用型):SELECT ... FROM ... ...

  8. Java 分布式和集中式理解

    文章转载自:https://blog.csdn.net/youanyyou/article/details/79406507

  9. cordova打包vue2(webpack)android、ios app

    使用cordova打包vue2(webpack)app for android ios1.vue项目通过vue-cli脚手架建立项目,使用webpack进行打包,下边是一整套命令. #npm 版本最好 ...

  10. python2.7 处理unicode和ascii字符串混用问题

    python2.7默认的编码方式为ascii码,如下可以查询: import sys sys.getdefaultencoding() 如果直接在unicode和ascii字符串之间做计算.比较.连接 ...