若是凉夜已成梦

青春里 总有些事情要努力去做 总有些梦想要拼命去追。


  • 运维

  • 前端

  • 编程

  • 随笔

  • hust-oj

1075: Time

发表于 2017-10-06   |   分类于 HUSTOJ   |   阅读次数 1,267

题目描述

p { margin-bottom: 0.21cm; }
Digital clock use 4 digits to express time, each digit is described by 3*3 characters (including”|”,”_”and” “).now given the current time, please tell us how can it be expressed by the digital clock.

输入

p { margin-bottom: 0.21cm; }
There are several test cases.
Each case contains 4 integers in a line, separated by space.
Proceed to the end of file.

输出

p { margin-bottom: 0.21cm; }
For each test case, output the time expressed by the digital clock such as Sample Output.

样例输入

1 2 5 6
2 3 4 2

样例输出

    _  _  _ 
  | _||_ |_ 
  ||_  _||_|
 _  _     _ 
 _| _||_| _|
|_  _|  ||_ 

参考代码

#include<stdio.h>
/*三行 十个数字 三个字符*/
char c[3][10][4]={{" _ ","   "," _ "," _ ","   "," _ "," _ "," _ "," _ "," _ "},{"| |","  |"," _|"," _|","|_|","|_ ","|_ ","  |","|_|","|_|"},{"|_|","  |","|_ "," _|","  |"," _|","|_|","  |","|_|"," _|"}};
void line0(int n[]) 
{
    for (int m=0;m<3;m++) 
    {
        for (int i=0;i<4;i++)
                    for (int j=0;j<3;j++)
                        printf("%c",c[m][n[i]][j]);
        printf("n");
    }
    return;
}
int main()
{
    int n[4];
    while(scanf("%1d%1d%1d%1d",&n[0],&n[1],&n[2],&n[3])!=EOF)
            line0(n);
    return 0;
}

解析

暂无

hustoj

发表评论 取消回复

邮箱地址不会被公开。 必填项已用*标注

*
*


hoxis wechat
著作权归作者所有
站点更新说明
  • 文章目录
  • 站点概览
若是凉夜已成梦

若是凉夜已成梦

青春里 总有些事情要努力去做 总有些梦想要拼命去追。

1904 日志
6 分类
12 标签
RSS
weibo github twitter facebook

友情链接

原站点 Skip Dreams孤独患者
© 2017 若是凉夜已成梦
Powered by WordPress | 已运行
Theme By NexT.Mist