YTU 1075: Time
1075: Time
时间限制: 1 Sec 内存限制: 128 MB
提交: 7 解决: 7
[提交][状态][讨论版]
题目描述
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.
输入
There are several test cases.
Each case contains 4 integers in a line, separated by space.
Proceed to the end of file.
输出
For each test case, output the time expressed by the digital clock such as Sample Output.
样例输入
1 2 5 6
2 3 4 2
样例输出
_ _ _
| _||_ |_
||_ _||_|
_ _ _
_| _||_| _|
|_ _| ||_
提示
The digits showed by the digital clock are as follows: _ _ _ _ _ _ _ _ | _| _||_||_ |_ ||_||_|| | ||_ _| | _||_| ||_| _||_|

#include<stdio.h>
int a[5];
int main()
{
while(scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3])!=EOF)
{
for(int i=0; i<3; i++)
{
for(int j=0; j<=3; j++)
{
if(i==0)
{
if(a[j]==1)
printf(" ");
else if(a[j]==2)
printf(" _ ");
else if(a[j]==3)
printf(" _ ");
else if(a[j]==4)
printf(" ");
else if(a[j]==5)
printf(" _ ");
else if(a[j]==6)
printf(" _ ");
else if(a[j]==7)
printf(" _ ");
else if(a[j]==8)
printf(" _ ");
else if(a[j]==9)
printf(" _ ");
else if(a[j]==0)
printf(" _ "); }
else if(i==1)
{
if(a[j]==1)
printf(" |");
else if(a[j]==2)
printf(" _|");
else if(a[j]==3)
printf(" _|");
else if(a[j]==4)
printf("|_|");
else if(a[j]==5)
printf("|_ ");
else if(a[j]==6)
printf("|_ ");
else if(a[j]==7)
printf(" |");
else if(a[j]==8)
printf("|_|");
else if(a[j]==9)
printf("|_|");
else if(a[j]==0)
printf("| |");
}
else if(i==2)
{
if(a[j]==1)
printf(" |");
else if(a[j]==2)
printf("|_ ");
else if(a[j]==3)
printf(" _|");
else if(a[j]==4)
printf(" |");
else if(a[j]==5)
printf(" _|");
else if(a[j]==6)
printf("|_|");
else if(a[j]==7)
printf(" |");
else if(a[j]==8)
printf("|_|");
else if(a[j]==9)
printf(" _|");
else if(a[j]==0)
printf("|_|");
}
} printf("\n");
}
}
return 0;
}
YTU 1075: Time的更多相关文章
- ytu 1057: 输入两个整数,求他们相除的余数(带参的宏 + 模板函数 练习)
1057: 输入两个整数,求他们相除的余数 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 177 Solved: 136[Submit][Status ...
- ytu 1058: 三角形面积(带参的宏 练习)
1058: 三角形面积 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 190 Solved: 128[Submit][Status][Web Boar ...
- ural 1075. Thread in a Space
1075. Thread in a Space Time limit: 1.0 secondMemory limit: 64 MB There are three points in a 3-dime ...
- HDOJ 1075
字典树 9890974 2013-12-25 15:31:06 Accepted 1075 468MS 59832K 1342 B G++ 泽泽 #include<stdio.h> #in ...
- ytu 1980:小鼠迷宫问题(DFS 深度优先搜索)
小鼠迷宫问题 Time Limit: 2 Sec Memory Limit: 64 MB Submit: 1 Solved: 1 [Submit][Status][Web Board] Desc ...
- HDU 1075 What Are You Talking About(Trie的应用)
What Are You Talking About Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K ...
- hdu 1075 (map)
http://acm.hdu.edu.cn/showproblem.php?pid=1075 What Are You Talking About Time Limit: 10000/5000 MS ...
- wikioi 1075 明明的随机数
/*============================================================ 1075 明明的随机数 题目描述 Description 明明想在学校中请 ...
- hdu 1075 What Are You Talking About
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075 题意:比较简单,易懂,这里不做说明. 解法:第一种方法:用map映射,耗时1000+ms:第二种 ...
随机推荐
- luogu3313 [SDOI2014]旅行
对每一个宗教建一棵线段树,然后树剖搞搞 #include <iostream> #include <cstdio> using namespace std; int n, m, ...
- Leetcode 315.计算右侧小于当前元素的个数
计算右侧小于当前元素的个数 给定一个整数数组 nums,按要求返回一个新数组 counts.数组 counts 有该性质: counts[i] 的值是 nums[i] 右侧小于 nums[i] 的元 ...
- NYOJ301-递推求值
递推求值 nyoj上矩阵专题里的10道题水了AC率最高的5道,惭愧,还不是完全自己写的,用了几乎两周的时间.模板题我是有自信写出来的,但对于高级一点的矩阵构造,我还是菜的抠脚. 这题感谢MQL大哥和她 ...
- PTA 01-复杂度1 最大子列和问题 (20分)
题目地址 https://pta.patest.cn/pta/test/15/exam/4/question/709 5-1 最大子列和问题 (20分) 给定KK个整数组成的序列{ N_1N1 ...
- POJ 2195 Going Home【最小费用流 二分图最优匹配】
题目大意:一个n*m的地图,上面有一些人man(m)和数量相等的house(H) 图上的距离为曼哈顿距离 问所有人住进一所房子(当然一个人住一间咯)距离之和最短是多少? 思路:一个人一间房,明显是二分 ...
- 洛谷P1504 积木城堡
题目描述 XC的儿子小XC最喜欢玩的游戏用积木垒漂亮的城堡.城堡是用一些立方体的积木垒成的,城堡的每一层是一块积木.小XC是一个比他爸爸XC还聪明的孩子,他发现垒城堡的时候,如果下面的积木比上面的积木 ...
- 移动端:UI图px单位转换rem单位的计算方法
简单说一下 em em 单位是相对于父元素字体大小来去定的.比方说: font-size:12px; 元素宽度是2em; 那么实际的宽度是 24px.(具体为什么,可以去查询资料,今天主讲rem) 简 ...
- AlertDialog自定义
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- how-do-i-access-windows-event-viewer-log-data-from-java
https://stackoverflow.com/questions/310355/how-do-i-access-windows-event-viewer-log-data-from-java
- 学习swift从青铜到王者之swift枚举07
空枚举 //空枚举 enum SomeEnumeration { // enumeration definition goes here } 枚举基本类型 //枚举基本类型 enum CompassP ...