Problem I: 液晶显示
来源:互联网 发布:淘宝网时尚女发型师装 编辑:程序博客网 时间:2024/04/29 01:20
Problem I: 液晶显示
Time Limit: 1 Sec Memory Limit: 32 MBSubmit: 1456 Solved: 524
[Submit][Status][Web Board]
Description
你的朋友刚买了一台新电脑,他以前用过的最强大的计算工具是一台袖珍计算器。现在,看着自己的新电脑,他有点失望,因为他更喜欢计算器上的LC显示器。所以,你决定写一个LC显示风格的程序帮他在电脑上显示数字。
Input
输入包括若干行,每一行有两个整数。输入为两个0表示结束,并且此行不被处理。
每行输入的两个整数s和n,满足1<=s<=10且0<=n<=99 999 999,其中n是要被现实的数字,s是n应该显示的大小(放大的倍数)。
Output
输出的数字是LC显示风格的:使用s个“-”表示水平线和s个“|”竖直线,每个数字刚好占据s+2列和2s+3行,所有没有“-”和“|”的空白处请用空格填满。并且每两个数字之间要有一列空格。
每一行输入数字对应上述一组LC显示风格输出。任意两组数字的输出之间用一个空行分割。
Sample Input
2 123453 678900 0
Sample Output
-- -- --
| | | | | |
| | | | | |
-- -- -- --
| | | | |
| | | | |
-- -- --
--- --- --- --- ---
| | | | | | | |
| | | | | | | |
| | | | | | | |
--- --- ---
| | | | | | | |
| | | | | | | |
| | | | | | | |
--- --- --- ---
HINT
#include <stdio.h>#include <stdlib.h>#include <string.h>// " " is 0;"|"is 1,"-" is 2;char zero[] = "323101303101323",one[] = "303301303301303",two[] = "323301323103323";char three[] = "323301323301323",four[] = "303101323301303",five[] = "323103323301323";char six[] = "323103323101323",seven[] = "323301303301303",eight[] = "323101323101323";char nine[] = "323101323301323"; void p_rint(int n,char de[],int k,int jj) //放大倍数,复制目标,第k层(共五层){ int i,j,p = k*3,pd = 1; for(i = 0; i < 3; i++) { for(j = 0; j < n; j++) { if(de[p] == '0') { printf(" "); pd = 1; } if(de[p] == '2') { printf("-"); pd = 1; } if(de[p] == '1' && pd == 1) { printf("|"); pd = 0; } } if(de[p] == '3') printf(" "); p++; } if(jj == 1) printf(" "); }int main(){ int n,tp = 0,jj; char w[9]; memset(w,0,sizeof(w)); while(~scanf("%d%s",&n,w)) { if(n == 0) return 0; if(tp++ != 0) printf("\n"); int i,j,pd = 0,t,g; for(i = 0; i < 5; i++) { if(i%2 != 0) t = n; else t = 1; for(g = 0; g < t; g++) { jj = 1; for(j = 0; j < strlen(w); j++) { if(j+1 == strlen(w)) jj = 0; if(w[j] == '0') p_rint(n,zero,i,jj); if(w[j] == '1') p_rint(n,one,i,jj); if(w[j] == '2') p_rint(n,two,i,jj); if(w[j] == '3') p_rint(n,three,i,jj); if(w[j] == '4') p_rint(n,four,i,jj); if(w[j] == '5') p_rint(n,five,i,jj); if(w[j] == '6') p_rint(n,six,i,jj); if(w[j] == '7') p_rint(n,seven,i,jj); if(w[j] == '8') p_rint(n,eight,i,jj); if(w[j] == '9') p_rint(n,nine,i,jj); } printf("\n"); } } memset(w,0,sizeof(w)); } return 0;} /************************************************************** Problem: 1068 User: 201401061013 Language: C Result: Accepted Time:0 ms Memory:748 kb****************************************************************/
0 0
- Problem I: 液晶显示
- Problem I
- Problem I
- Problem I
- Problem I
- Problem I
- Problem I
- Problem-I
- Problem I
- Problem B & Problem I
- Problem : 1022 ( Train Problem I )
- Problem I : Palindrome Partitioning I
- 1022 Train Problem I
- HDU1022 Train Problem I
- 1997: Simple Problem I
- Train Problem I
- 1022:Train Problem I
- 1022 Train Problem I
- 臭苹果
- BeautifuSoup整理笔记
- 在Bootstrap下用JavaScript自定义右键菜单
- 生病啦
- 数据结构(C++版)第三章 栈和队列
- Problem I: 液晶显示
- Android如何立即退出整个程序
- CSplitButton按钮的使用
- SilverLight TextBox水印效果实现
- HDU3533:Escape(BFS)
- 最新版SDWebImage的使用
- HDFS 的API 封装成 class Scala操作
- 为什么ListView.setOnItemClickListener、setOnCreateContextMenuListener会无效
- 最大子序列和