HDU 2017 多校联赛4 1011 Time To Get Up

Problem Description

Little Q’s clock is alarming! It’s time to get up now! However, after reading the time on the clock, Little Q lies down and starts sleeping again. Well, he has 5 alarms, and it’s just the first one, he can continue sleeping for a while.

Little Q’s clock uses a standard 7-segment LCD display for all digits, plus two small segments for the ”:”, and shows all times in a 24-hour format. The ”:” segments are on at all times.

Your job is to help Little Q read the time shown on his clock.

Input

The first line of the input contains an integer T(1≤T≤1440), denoting the number of test cases.

In each test case, there is an 7×21 ASCII image of the clock screen.

All digit segments are represented by two characters, and each colon segment is represented by one character. The character ”X” indicates a segment that is on while ”.” indicates anything else. See the sample input for details.

Output

For each test case, print a single line containing a string t in the format of HH:MM, where t(00:00≤t≤23:59), denoting the time shown on the clock.

Sample Input


.XX…XX…..XX…XX. 
X..X….X……X.X..X 
X..X….X.X….X.X..X 
……XX…..XX…XX. 
X..X.X….X….X.X..X 
X..X.X………X.X..X 
.XX…XX…..XX…XX.

Sample Output

02:38

题目大意:

这就是给你一个7*21的字符矩阵,看它打印的时间是多少。下面是0—9的打印方法。每个数字占4个字符,数字间空有一格,方便区分。 
.xx. …. .xx. .xx. …. .xx. .xx. .xx. .xx. .xx. 
x..x …x …x …x x..x x… x… …x x..x x..x 
x..x …x …x …x x..x x… x… …x x..x x..x 
…. …. .xx. .xx. .xx. .xx. .xx. …. .xx. .xx. 
x..x …x x… …x …x …x x..x …x x..x …x 
x..x …x x… …x …x …x x..x …x x..x …x 
.xx. …. .xx. .xx. …. .xx. .xx. …. .xx. .xx.

c++

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char m[8][25];
int sz(int x)
{
    if(m[3][x]=='X'&&m[3][x+1]=='X')
    {
        if(m[2][x-1]=='.'&&m[1][x-1]=='.')
        {
            if(m[4][x-1]=='.'&&m[5][x-1]=='.')
                return(3);
            else return(2);
        }
        else
        {
            if(m[2][x+2]=='.'&&m[1][x+2]=='.')
            {
                if(m[4][x-1]=='.'&&m[5][x-1]=='.')
                    return(5);
                else return(6);
            }
            else
            {
                if(m[4][x-1]=='.'&&m[5][x-1]=='.')
                {
                    if(m[6][x]=='.'&&m[6][x+1]=='.')
                        return(4);
                    else return(9);
                }
                else return(8);
            }
        }
    }
    else
    {
        if(m[6][x]=='.'&&m[6][x+1]=='.')
        {
            if(m[0][x]=='.'&&m[0][x+1]=='.')
                return(1);
            else return(7);
        }
        else return(0);
    }
}
int main()
{
    int a,b,c,d,e;
    cin>>a;
    getchar();
    while(a--)
    {
        for(b=0;b<7;b++)
        {
            for(c=0;c<21;c++)
                scanf("%c",&m[b][c]);
            getchar();
        }
        b=sz(1);
        c=sz(6);
        d=sz(13);
        e=sz(18);
        printf("%d%d:%d%d\n",b,c,d,e);
    }
    return 0;
}





全部评论

相关推荐

昨天 13:42
门头沟学院 Java
运气爆棚福星高赵:清✌️不用很在意项目,八股算法是重点,八股算法说的过去绝对要您
点赞 评论 收藏
分享
2024-12-27 23:45
已编辑
三江学院 Java
程序员牛肉:死局。学历+无实习+项目比较简单一点。基本就代表失业了。 尤其是项目,功能点实在是太假了。而且提问点也很少。第一个项目中的使用jwt和threadlocal也可以作为亮点写出来嘛?第二个项目中的“后端使用restful风格”,“前端采用vue.JS”,“使用redis”也可以作为亮点嘛? 项目实在是太简单了,基本就是1+1=2的水平。而你目标投递的肯定也是小厂,可小厂哪里有什么培养制度,由于成本的问题,人家更希望你来能直接干活,所以你投小厂也很难投。基本就是死局,也不一定非要走后端这条路。可以再学一学后端之后走测试或者前端。 除此之外,不要相信任何付费改简历的。你这份简历没有改的必要了,先沉淀沉淀
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务