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. 自建Kubernetes logtail日志采集客户端安装方式

    自建Kubernetes安装方式 前提条件 Kubernetes集群版本1.8及以上. 已经安装Helm命令,版本2.6.4及以上. 安装步骤 在日志服务控制台创建一个Project,Project名 ...

  2. mysql数据库分区功能及实例详解

    分区听起来怎么感觉是硬盘呀,对没错除了硬盘可以分区数据库现在也支持分区了,分区可以解决大数据量的处理问题,下面一起来看一个mysql数据库分区功能及实例详解   一,什么是数据库分区 前段时间写过一篇 ...

  3. 在SharePoint 2013 场中移除服务器,提示 cacheHostInfo is null 错误

    Problem 在SharePoint 2013 场中移除服务器,提示 cacheHostInfo is null 错误 Resolution 这是由于SharePoint 2013中分布式缓存实例( ...

  4. Spark 论文篇-大型集群上的快速和通用数据处理架构(中英双语)

    论文内容: 待整理 参考文献: An Architecture for Fast and General Data Processing on Large Clusters. Matei Zahari ...

  5. Mysql依赖库Boost的源码安装,linux下boost库的安装

      boost‘准标准库’安装过程.安装的是boost_1_60_0. (1)首先去下载最新的boost代码包,网址www.boost.org. (2)进入到自己的目录,解压: bzip2 -d bo ...

  6. +: indexed part-select

    That syntax is called an indexed part-select. The first term is the bit offset and the second term i ...

  7. 9-8-B树-查找-第9章-《数据结构》课本源码-严蔚敏吴伟民版

    课本源码部分 第9章  查找 - B树 ——<数据结构>-严蔚敏.吴伟民版        源码使用说明  链接☛☛☛ <数据结构-C语言版>(严蔚敏,吴伟民版)课本源码+习题集 ...

  8. windows_硬盘上设置虚拟内存

    1)在桌面上的“计算机”或“我的电脑”上右键->属性->高级->性能->设置->高级->虚拟内存->更改. 2)在虚拟内存更改页面,先选择在哪个磁盘上设置虚拟 ...

  9. 基于AC有限状态机的多模匹配算法

    参考链接:http://www.cnblogs.com/zzqcn/p/3525636.html 感谢原文作者. 花了两天半时间实现并测试了算法. 按照上文的思路实现了一遍,可能是原文中有些地方描述的 ...

  10. Java知多少(1) 语言概述

    Java语言是SUN(Stanford University Network,斯坦福大学网络公司)公司1995年推出的一门高级编程语言,起初主要应用在小型消费电子产品上,后来随着互联网的兴起,Java ...