poj 1102 LC-Display
2013-09-12 20:22
274 查看
LC-Display
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
Sample Output
Source
Mid-Central European Regional Contest 1999
看完样例就知道什么意思了
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 14432 | Accepted: 5763 |
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
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
- poj1102——LC-Display
- UVALive5642 UVA706 HDU1332 POJ1102 LC-Display【打印图案】
- poj_1102_LC-Display(数段码模拟)
- poj 1102 LC-Display显示器
- POJ_1102_LC-Display
- poj1102 LC-Display
- poj1102 LC-Display
- poj 1102 LC-Display
- POJ 1102 - LC-Display
- POJ 1102 LC-Display
- poj 1102 LC-Display(模拟)
- POJ 1102 LC Display G++
- POJ 1102 LC-Display(模拟题)
- 1102 LC-Display
- POJ 1102 LC-Display 模拟
- OpenJudge / Poj 1102 LC-Display C++
- POJ-1102
- UVA 706 - LC-Display
- PC/UVa 题号: 110104/706 LC-Display (液晶显示屏)题解