HDU 6077 Time To Get Up(水~)

来源:互联网 发布:cs demo下载软件 编辑:程序博客网 时间:2024/05/29 15:05

Description
识别表上显示的数字输出时间
Input
第一行一整数T表示用例组数,每组用例输入一个7*21的字符矩阵表示当前时间(1<=T<=1440)
Output
输出当前时间
Sample Input
这里写图片描述
Sample Output
02:38
Solution
简单题,找出一些关键点区分数字即可
Code

#include<cstdio>using namespace std;int T;char s[11][33];int check(int t){    int f1,f2,f3,f4;    f1=(s[4][2+t]=='X'),f2=(s[1][2+t]=='X'),f3=(s[7][2+t]=='X');    if(!f1)    {        if(f3)return 0;        if(f2)return 7;        return 1;    }    f1=(s[2][1+t]=='X'),f2=(s[2][4+t]=='X'),f3=(s[5][1+t]=='X'),f4=(s[5][4+t]=='X');    if(s[7][2+t]=='.')return 4;    if(f1&&f2&&f3&&f4)return 8;    if(f1&&f2&&f4)return 9;    if(f1&&f3&&f4)return 6;    if(f2&&f3)return 2;    if(f2&&f4)return 3;    if(f1&&f4)return 5;}int main(){    scanf("%d",&T);    while(T--)    {        for(int i=1;i<=7;i++)scanf("%s",s[i]+1);        int a=check(0),b=check(5),c=check(12),d=check(17);        printf("%d%d:%d%d\n",a,b,c,d);    }    return 0;}
原创粉丝点击