HNUSTOJ 1516:Loky的烦恼
1516: Loky的烦恼
时间限制: 1 Sec 内存限制: 128 MB提交: 242 解决: 66
[提交][状态][讨论版]
题目描述
loky喜欢上一个女孩,女孩在loky眼中绝对是10分女。唯一有点遗憾的是女生有点近视,为了不影响她的美貌,所以她不想戴眼镜,这下问题来了--电脑上的数字她看不清楚。loky想如果自己能把这问题解决了,说不定女孩就喜欢上自己了。数字放大的模型loky已经搞定:数字
输入
多行输入。每行包括一个由数字0-9构成的字符串s,s长度不超过10000。
输出
每一行输入的字符串产生的输出描述如下:
字符串的每个数字字符按放大形式输出。规定每一行只能输出10个数字字符,超过则换行输出,详见样例。
样例输入
0123456789
00123456789
样例输出
--- ---- ---- ---- ---- ---- --- ---
| | | | | | | | | | | | | |
| | | | | | | | | | | | | |
--- ---- --- --- --- --- ---
| | | | | | | | | | | | |
| | | | | | | | | | | | |
--- ---- ---- ---- --- --- ----
--- --- ---- ---- ---- ---- ---- ---
| | | | | | | | | | | | | |
| | | | | | | | | | | | | |
--- ---- --- --- --- ---
| | | | | | | | | | | | | |
| | | | | | | | | | | | | |
--- --- ---- ---- ---- --- ---
---
| |
| |
---
|
|
----
提示
必须极小心数字的字符格式,建议以sample为准
来源
这道题是学校oj上的题,第一次见到的时候还是刚刚学C语言不久,看着这道题很久都不知道怎么下手,今天无意中又看到了这道题,觉得应该再尝试一下,然后就写起了代码,终于写出来了,别提多开心了,虽然这道题不难,但是能做出自己以前没做出的题,虽然只是迈出一小步,但是真的很开心;代码如下:
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const char d[10][7][7]={
{" --- "," | |"," | |"," "," | |"," | |"," --- "},{" "," | "," | "," "," | "," | "," "},
{" ---- "," |"," |"," --- "," | "," | "," ----"},{" ---- "," |"," |"," ---- "," |"," |"," ---- "},
{" "," | |"," | |"," --- "," |"," |"," "},{" ----"," | "," | "," --- "," |"," |"," ---- "},
{" ----"," | "," | "," --- "," | |"," | |"," --- "},{" ---- "," |"," |"," "," |"," |"," "},
{" --- "," | |"," | |"," --- "," | |"," | |"," --- "},{" --- "," | |"," | |"," --- "," |"," |"," ---- "}};
void print(int &n,const int *a){
for(int i=0;i<7;i++){
for(int j=0;j<n;j++){
printf("%s",d[a[j]][i]);
}
printf("\n");
}
n = 0;
}
char ch[10005];
int a[10005];
int main(){
while(scanf("%s",ch)==1){
int len = strlen(ch),cnt=0;
for(int i=0;i<len;i++){
a[cnt++] = ch[i]-'0';
if(cnt == 10 ||(i==len-1)) print(cnt,a);
}
}
}