POJ 1102 - LC-Display
Description
Input
The input file will be terminated by a line containing two zeros. This line should not be processed.
Output
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
#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的更多相关文章
- poj 1102.LC-Display 解题报告
题目链接:http://poj.org/problem?id=1102 题目意思:就是根据给出的格式 s 和 数字 n,输出数值 n 的 LCD 显示.数值 n 的每个数字要占据 s + 2 列 和 ...
- POJ 1102
#include<iostream>// cheng da cai zi 11.14 using namespace std; int main() { int i; int j; int ...
- 设备管理 USB ID
发现个USB ID站点,对于做设备管理识别的小伙伴特别实用 http://www.linux-usb.org/usb.ids 附录: # # List of USB ID's # # Maintain ...
- 类声明、类作用域、前向声明、this指针、嵌套类、PIMPL 技法 等
一.类声明 //类是一种用户自定义类型,声明形式: class 类名称 { public: 公有成员(外部接口) private: 私有 ...
- 2019nc#4
题号 标题 已通过代码 题解 通过率 团队的状态 A meeting 点击查看 树直径 604/2055 B xor 点击查看 线段树维护线性基交 81/861 未通过 C sequence 点击 ...
- Treap + 无旋转Treap 学习笔记
普通的Treap模板 今天自己实现成功 /* * @Author: chenkexing * @Date: 2019-08-02 20:30:39 * @Last Modified by: chenk ...
- SAP T CODE : Description (Program)
SAP T CODE : Description (Program) V : Quickstart RKCOWUSL (RKCOWUSL)V+01 : Create Sales Call (SAPMV ...
- POJ题目细究
acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP: 1011 NTA 简单题 1013 Great Equipment 简单题 102 ...
- 【转】POJ百道水题列表
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...
随机推荐
- 自建Kubernetes logtail日志采集客户端安装方式
自建Kubernetes安装方式 前提条件 Kubernetes集群版本1.8及以上. 已经安装Helm命令,版本2.6.4及以上. 安装步骤 在日志服务控制台创建一个Project,Project名 ...
- mysql数据库分区功能及实例详解
分区听起来怎么感觉是硬盘呀,对没错除了硬盘可以分区数据库现在也支持分区了,分区可以解决大数据量的处理问题,下面一起来看一个mysql数据库分区功能及实例详解 一,什么是数据库分区 前段时间写过一篇 ...
- 在SharePoint 2013 场中移除服务器,提示 cacheHostInfo is null 错误
Problem 在SharePoint 2013 场中移除服务器,提示 cacheHostInfo is null 错误 Resolution 这是由于SharePoint 2013中分布式缓存实例( ...
- Spark 论文篇-大型集群上的快速和通用数据处理架构(中英双语)
论文内容: 待整理 参考文献: An Architecture for Fast and General Data Processing on Large Clusters. Matei Zahari ...
- Mysql依赖库Boost的源码安装,linux下boost库的安装
boost‘准标准库’安装过程.安装的是boost_1_60_0. (1)首先去下载最新的boost代码包,网址www.boost.org. (2)进入到自己的目录,解压: bzip2 -d bo ...
- +: indexed part-select
That syntax is called an indexed part-select. The first term is the bit offset and the second term i ...
- 9-8-B树-查找-第9章-《数据结构》课本源码-严蔚敏吴伟民版
课本源码部分 第9章 查找 - B树 ——<数据结构>-严蔚敏.吴伟民版 源码使用说明 链接☛☛☛ <数据结构-C语言版>(严蔚敏,吴伟民版)课本源码+习题集 ...
- windows_硬盘上设置虚拟内存
1)在桌面上的“计算机”或“我的电脑”上右键->属性->高级->性能->设置->高级->虚拟内存->更改. 2)在虚拟内存更改页面,先选择在哪个磁盘上设置虚拟 ...
- 基于AC有限状态机的多模匹配算法
参考链接:http://www.cnblogs.com/zzqcn/p/3525636.html 感谢原文作者. 花了两天半时间实现并测试了算法. 按照上文的思路实现了一遍,可能是原文中有些地方描述的 ...
- Java知多少(1) 语言概述
Java语言是SUN(Stanford University Network,斯坦福大学网络公司)公司1995年推出的一门高级编程语言,起初主要应用在小型消费电子产品上,后来随着互联网的兴起,Java ...