Time
問題 : Time
時(shí)間限制:?1 Sec??內(nèi)存限制:?128 MB題目描述
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:_ _ _ _ _ _ _ _ | _| _||_||_ |_ ||_||_|| |||_ _| | _||_| ||_| _||_|解題思路
水題,按照所給的數(shù)字輸出對(duì)應(yīng)數(shù)字時(shí)鐘顯示的數(shù)字就可以了。
#include <stdio.h> #include <string.h> char top1[10][4] = {" _ ", " ", " _ ", " _ ", " ", " _ ", " _ ", " _ ", " _ ", " _ "}; char top2[10][4] = {"| |", " |", " _|", " _|", "|_|", "|_ ", "|_ ", " |", "|_|", "|_|"}; char top3[10][4] = {"|_|", " |", "|_ ", " _|", " |", " _|", "|_|", " |", "|_|", " _|"}; int main() {int s, a[4];while (~scanf("%d%d%d%d", &a[0], &a[1], &a[2], &a[3])){for (int i = 0; i < 4; i++)printf("%s", top1[a[i]]);printf("\n");for (int i = 0; i < 4; i++)printf("%s", top2[a[i]]);printf("\n");for (int i = 0; i < 4; i++)printf("%s", top3[a[i]]);printf("\n");}return 0; }轉(zhuǎn)載于:https://www.cnblogs.com/lzyws739307453/p/8988016.html
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
- 上一篇: ActiveMQ 的连接和会话
- 下一篇: shutil