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. fork failed because of Out Of Memory

    Maybe virtual memory over commit is prevented in your system. If it is prevented, then the virtual m ...

  2. MVC通用控件库展示-MVC4.0+WebAPI+EasyUI+Knockout--SNF快速开发平台3.0

    在我们开发中怎么才能提高效率,就是要有大量的公共组件(控件)可以直接使用而不用自己再开发一遍,既然是公共控件那也得简单实用才行.下面就介绍一下SNF-MVC当中的控件库. 总体控件库展示: 1.通用用 ...

  3. Atitit phpstorm配置attilax总结

    Atitit phpstorm配置attilax总结 1. 前期准备 1 1.1. 配置interpreter 1 1.2. debug需要xdebug的支持,不管是script模式还是web模式 3 ...

  4. Atitit  验证 数字验证 非空验证的最佳算法  h5

    Atitit  验证 数字验证 非空验证的最佳算法  h5 <td><select class="searchBox-select"   style=" ...

  5. 容器网络——从CNI到Calico

    从容器诞生开始,存储和网络这两个话题就一直为大家津津乐道.我们今天这个环境下讲网络这个问题,其实是因为容器对网络的需求,和传统物理.虚拟环境对网络环境需求是有差别的,主要面临以下两个问题: 过去Iaa ...

  6. lua -- 生成协议

    这是爬塔的协议 <?xml version="1.0" encoding="utf-8" ?> <coder name="Tower ...

  7. adb命令使用总结

    1.启动/停止 启动 adb server 命令: adb start-server (一般无需手动执行此命令,在运行 adb 命令时若发现 adb server 没有启动会自动调起.) 停止 adb ...

  8. Goldengate:ERROR 180 encountered commit SCN that is not greater than the highest SCN already processed

    How to recover from Extract ERROR 180 encountered commit SCN that is not greater than the highest SC ...

  9. Java编程的逻辑 (81) - 并发同步协作工具

    ​本系列文章经补充和完善,已修订整理成书<Java编程的逻辑>,由机械工业出版社华章分社出版,于2018年1月上市热销,读者好评如潮!各大网店和书店有售,欢迎购买,京东自营链接:http: ...

  10. Zookeeper系列四:Zookeeper实现分布式锁、Zookeeper实现配置中心

    一.Zookeeper实现分布式锁 分布式锁主要用于在分布式环境中保证数据的一致性. 包括跨进程.跨机器.跨网络导致共享资源不一致的问题. 1. 分布式锁的实现思路 说明: 这种实现会有一个缺点,即当 ...