zoukankan      html  css  js  c++  java
  • nyoj 288 Time

    Time

    时间限制:1000 ms  |  内存限制:65535 KB

    难度:2

    描述

    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.

    Hint:

    The digits showed by the digital clock are as follows:

       _  _     _  _  _  _  _  _

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

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

    输入

    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

    样例输出

        _  _  _

      | _||_ |_

      ||_  _||_|

     _  _     _

     _| _||_| _|

    |_  _|  ||_ 

    #include <stdio.h>
    int main()
    {
    	int i,a[5];
        char s1[][5]={" _ ","   "," _ "," _ ","   "," _ "," _ "," _ "," _ "," _ "};
        char s2[][5]={"| |","  |"," _|"," _|","|_|","|_ ","|_ ","  |","|_|","|_|"};
        char s3[][5]={"|_|","  |","|_ "," _|","  |"," _|","|_|","  |","|_|"," _|"};   
        while(scanf("%d",&a[0])!=EOF)
        {
    	    for(i=1;i<4;i++)
    	  	    scanf("%d",&a[i]);
    	    for(i=0;i<4;i++)
    	    	printf("%s",s1[a[i]]);
    	   		printf("
    ");
    	    for(i=0;i<4;i++)
    	  	  printf("%s",s2[a[i]]);
    	  	  printf("
    ");
    	    for(i=0;i<4;i++)
    	   	  printf("%s",s3[a[i]]);
    	  	  printf("
    ");
        }
        return 0;
    }        
    

      

  • 相关阅读:
    Win8常用快捷键
    清除远程桌面连接记录
    通过注册表改变“我的文档”等的默认位置,防止系统重装造成数据丢失
    HTML 转义字符对照表
    r语言 函数
    sparkr——报错
    R语言--saprkR基本使用
    r绘图基本
    R绘制中国地图,并展示流行病学数据
    r画饼图
  • 原文地址:https://www.cnblogs.com/zhangliu/p/7052665.html
Copyright © 2011-2022 走看看