poj 1102 LC-Display
来源:互联网 发布:js 获取contextpath 编辑:程序博客网 时间:2024/03/29 06:46
LC-Display
Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 14432 Accepted: 5763
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.
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.)
Output a blank line after each number. (You will find a sample of each digit in the sample output.)
Sample Input
2 123453 678900 0
Sample Output
-- -- -- | | | | | | | | | | | | -- -- -- -- | | | | | | | | | | -- -- -- --- --- --- --- --- | | | | | | | || | | | | | | || | | | | | | | --- --- --- | | | | | | | || | | | | | | || | | | | | | | --- --- --- ---
Source
Mid-Central European Regional Contest 1999
看完样例就知道什么意思了
#include <iostream>#include <cstring>using namespace std;char n1[] = "- -- -----";char n2[] = "| ||| ||";char n3[] = "||||| |||";char n4[] = " ----- --";char n5[] = "| | | | ";char n6[] = "|| |||||||";char n7[] = "- -- -- --";int main(){ int m; char n[10]; while (cin>>m>>n,(n[0]-'0')||m) { int len = strlen(n); for (int i=0; i<len; i++) { cout<<" "; int num = n[i]-'0'; for (int j=0; j<m; j++) { cout<<n1[num]; } cout<<" "; } cout<<endl; int temp = m; while (temp--) { for (int i=0; i<len; i++) { int num = n[i]-'0'; cout<<n2[num]; for (int j=0; j<m; j++) { cout<<" "; } cout<<n3[num]; cout<<" "; } cout<<endl; } for (int i=0; i<len; i++) { cout<<" "; int num = n[i]-'0'; for (int j=0; j<m; j++) { cout<<n4[num]; } cout<<" "; } cout<<endl; temp = m; while (temp--) { for (int i=0; i<len; i++) { int num = n[i]-'0'; cout<<n5[num]; for (int j=0; j<m; j++) { cout<<" "; } cout<<n6[num]; cout<<" "; } cout<<endl; } for (int i=0; i<len; i++) { cout<<" "; int num = n[i]-'0'; for (int j=0; j<m; j++) { cout<<n7[num]; } cout<<" "; } cout<<endl<<endl; } return 0;}
- POJ 1102 LC DISPLAY
- poj 1102 LC-Display
- POJ 1102 LC-Display
- poj 1102 LC-Display
- POJ 1102 - LC-Display
- poj 1102 LC—display
- POJ 1102 LC-Display 模拟
- poj 1102 LC-Display(模拟)
- POJ 1102 LC Display 笔记
- POJ 1102 LC-Display(模拟题)
- 1102 LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- Hadoop进程启动过程分析
- 大家好!欢迎来到我的博客!
- BP神经网络C程序
- 在ListView上使用动画
- [catch]--A Mathematical Curiosity
- poj 1102 LC-Display
- HDU 4716 A Computer Graphics Problem 解题报告
- 【Cocos2d-html5游戏引擎学习笔记(1)】游戏引擎初探究和搭建开发环境
- 黑马程序员-集合框架总结
- 《UNIX环境高级编程》笔记--文件共享
- 华为2014校园招聘机试题(一)
- BOLTZMAN神经网络C程序
- 并发队列ConcurrentLinkedQueue和阻塞队列LinkedBlockingQueue使用场景总结
- mysql常用语法