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. APP安全测评checklist---Android

    首先,你的app得先混淆:AndroidStudio 混淆打包 先来个checklist: 编号 检查项目 测评结果 1 明文传输用户名.密码和验证码等敏感信息. 2 不安全的本地存储. 3 泄漏后台 ...

  2. 【java】求两个字符串的最长公共子串

    这个是华为OJ上的一道题目.首先,如果我们用java写代码,华为OJ有以下三条规则需遵守,否则编译无法通过或者用例无法通过,规则如下: (1)一定不可以有包名: (2)主类名只能为Main: (3)不 ...

  3. CPP Note

    hello.cpp -> 编译代码g++ hello.cpp -o a -> a.out 区分大小写的编程语言 内置类型 一些基本类型可以使用一个或多个类型修饰符进行修饰: signed: ...

  4. 三星S4 i9508 4.4.2 root 教程

    现在有很多一键root的软件,但是各怀鬼胎,最好不用. 最近玩腻了三方的rom,刷回了官方的rom,顿时更稳定了,以外的是这个版本的导航被切了,拍手叫好啊.输入法引入了搜狗的云输入,更方便了,官方的输 ...

  5. JAVA(一)JAVA基础/面向对象基础/高级面向对象

    成鹏致远 | lcw.cnblog.com |2014-01-23 JAVA基础 1.开发环境搭建 JAVA程序的执行流程 JAVA命令->要使用一个*.class文件(类文件)->通过c ...

  6. 【emWin】例程二十六:窗口对象——Listbox

    简介: 列表框用于选择列表的一个元素.创建的列表框可以没有环绕的框架窗口,或者作为 FRAMEWIN 小工具的子窗口建立列表框中的项目被选定后,会突出显示. 触摸校准(上电可选择是否进入校准界面) 示 ...

  7. ecshop首页调用团购信息产品购买人数

    当我们在ecshop后台录入ecshop的团购信息之后,我们在ecshop的前台首页index.php里面,可以看到他能调用ecshop的团购商品信息,其中就包括团购商品的一些价格信息.但是如何在ec ...

  8. dhcp server 移植记录

    这次移植 WIFI ,需要做成 AP 模式,所以,需要移植 dhcp 服务端 busybox 里面自带 udhcpd 选项. 打开buildroot , make busybox-menuconfig ...

  9. APACHE多个服务器的配置

    APACHE 多个服务器的配置? 网站目录:d:www 下设两个站点:1.D:wwwszbw  2.D:wwwweb 注意前面,要开启 Vhost 及 vhos 相关 so <VirtualHo ...

  10. laravel 5.4 中使用migrate

    1. 创建表结构 a. 命令: php artisan make:migration create_posts_table 2.生产文件 <?php use Illuminate\Support ...