LC-Display
来源:互联网 发布:如何查看域名注册商 编辑:程序博客网 时间:2024/03/29 09:02
LC-Display
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 20000/10000K (Java/Other)
Total Submission(s) : 11 Accepted Submission(s) : 4
Problem 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
-- -- -- | | | | | | | | | | | | -- -- -- -- | | | | | | | | | | -- -- -- --- --- --- --- --- | | | | | | | || | | | | | | || | | | | | | | --- --- --- | | | | | | | || | | | | | | || | | | | | | | --- --- --- ---模拟即可,三重循环+判断#include <stdio.h>#include <stdlib.h>#include <string.h>char num[100000000];int digit[100000000];int main(){ int n,i,j,k,m,l,q,p; int ns[10][5][3] = { {0,1,0, 1,0,1, 0,0,0, 1,0,1, 0,1,0}, {0,0,0, 0,0,1, 0,0,0, 0,0,1, 0,0,0}, {0,1,0, 0,0,1, 0,1,0, 1,0,0, 0,1,0}, {0,1,0, 0,0,1, 0,1,0, 0,0,1, 0,1,0}, {0,0,0, 1,0,1, 0,1,0, 0,0,1, 0,0,0}, {0,1,0, 1,0,0, 0,1,0, 0,0,1, 0,1,0}, {0,1,0, 1,0,0, 0,1,0, 1,0,1, 0,1,0}, {0,1,0, 0,0,1, 0,0,0, 0,0,1, 0,0,0}, {0,1,0, 1,0,1, 0,1,0, 1,0,1, 0,1,0}, {0,1,0, 1,0,1, 0,1,0, 0,0,1, 0,1,0} }; while(1) { scanf("%d\n",&n); scanf("%s",num); m=strlen(num); for(i=0; i<m; i++) { digit[i]=num[i]-48; } if(n==0&&num[0]=='0') return 0; for(i=0; i<5; i++) { if(i==0||i==4||i==2) { for(j=0; j<m; j++) { for(k=0; k<3; k++) { { if(k==0) printf(" "); else if(k==2) printf(" "); else { for(l=0; l<n; l++) { if(ns[digit[j]][i][k]==1) printf("-"); else printf(" "); } } } } } printf("\n"); } else { for(q=0; q<n; q++) { for(j=0; j<m; j++) { for(k=0; k<3; k++) { if(k==0) { if(ns[digit[j]][i][k]==1) printf("|"); else printf(" "); } else if(k==2) { if(ns[digit[j]][i][k]==1) printf("| "); else printf(" "); } else { for(p=0; p<n; p++) { printf(" "); } } } } printf("\n"); } } } printf("\n"); } return 0;}
0 0
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display(ZJU_1146)
- POJ 1102 LC DISPLAY
- poj 1102 LC-Display
- LC-Display(UVa706)
- poj1102 LC-Display
- HDU 1332 LC-Display
- uva706 LC-Display
- LC-Display POJ1102
- poj1102 LC-Display
- POJ 1102 LC-Display
- js调用php和php调用js的方法举例
- 自制带第三方库的FFmpeg SDK
- VS2008编写C++示例程序
- arclist当前样式
- xx
- LC-Display
- OpenCV的概况和基本数据结构
- android4.0.3 修改启动动画和开机声音
- 关于eclipse更新SDK失败问题处理
- ZipArchive
- [LeetCode] N-Queens II
- POJ 1077 Eight
- jstl long转日期
- 拓扑排序