HDU6077 思维(水)
来源:互联网 发布:雅马哈网络经销商查询 编辑:程序博客网 时间:2024/06/07 20:04
Time To Get Up
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 407 Accepted Submission(s): 319
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 has5 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.
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 an7×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.
In each test case, there is an
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 stringt in the format of HH:MM , where t(00:00≤t≤23:59) , denoting the time shown on the clock.
Sample Input
1.XX...XX.....XX...XX.X..X....X......X.X..XX..X....X.X....X.X..X......XX.....XX...XX.X..X.X....X....X.X..XX..X.X.........X.X..X.XX...XX.....XX...XX.
Sample Output
02:38
Source
2017 Multi-University Training Contest - Team 4
比较耗时间的方法:
#include<cstdio>#include<iostream>#include<cstring>#include<string>using namespace std;char str[10][30];char map[10][7][10]={ {".XX.", "X..X","X..X","....","X..X","X..X",".XX.",},{"....", "...X", "...X", "....", "...X", "...X", "....",},{".XX.", "...X", "...X", ".XX.", "X...", "X...", ".XX.",}, {".XX.", "...X", "...X", ".XX.", "...X", "...X", ".XX.",},{"....", "X..X", "X..X", ".XX.", "...X", "...X", "....",},{".XX.", "X...", "X...", ".XX.", "...X", "...X", ".XX.",},{".XX.", "X...", "X...", ".XX.", "X..X", "X..X", ".XX.",},{".XX.", "...X", "...X", "....", "...X", "...X", "....",},{".XX.", "X..X", "X..X", ".XX.", "X..X", "X..X", ".XX.",},{".XX.", "X..X", "X..X", ".XX.", "...X", "...X", ".XX.",}};int get_num(int s){ int i,j,k; for(k=0;k<10;k++) { for(i=0;i<7;i++){for(j=s;j<s+4;j++){if(map[k][i][j-s]!=str[i][j])break;}if(j!=s+4) break;}if(i==7&&j==s+4){//cout<<k<<endl; return k;} }}int main(){int t;int h1,h2,m1,m2;scanf("%d",&t);while(t--){for(int i=0;i<7;i++){scanf("%s",str[i]);} h1=get_num(0); h2=get_num(5); m1=get_num(12); m2=get_num(17); printf("%d%d:%d%d\n",h1,h2,m1,m2);}}
找规律特点的便捷的方法:
#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>using namespace std;typedef long long LL;const int MOD = 1e9 + 7;const int MAXN = 5e5 + 10;char str[30][30];int check(int s) {if (str[0][s + 1] == 'X') {if (str[1][s] == 'X') {if (str[1][s + 3] == 'X') {if (str[3][s + 1] == 'X') {if (str[4][s] == 'X') return 8;else return 9;} else {return 0;}} else {if (str[4][s] == 'X') return 6;else return 5;}} else {if (str[4][s] == 'X') return 2;else if (str[3][s+1] == 'X') return 3;else return 7;}} else {if (str[1][s] == 'X') return 4;else return 1;}}int main(){int T;for (scanf("%d", &T); T--; ) {for (int i = 0; i < 7; i++) {scanf("%s", str[i]);}printf("%d%d:%d%d\n", check(0), check(5), check(12), check(17));int h1 = check(0);}return 0;}
阅读全文
0 0
- HDU6077 思维(水)
- HDU6077
- Hdu6077 Time To Get Up(2017多校第4场)
- (hdu6077)2017杭电多校联赛第四场-Time To Get Up 模拟题
- HDU6077-Time To Get Up
- HDU6077-Time To Get Up
- hdu6077 Time To Get Up
- HDU6077 Time To Get Up 暴力
- codeforce 4B(思维水题)
- 【codeforces】A. Array(思维水题)
- HDU 6124 Euler theorem(水+思维)
- 互联网思维-产品思维(1)
- 互联网思维-产品思维(2)
- 互联网思维-NO.1思维(1)
- 互联网思维-NO.1思维(2)
- 互联网思维-标签思维(1)
- 互联网思维-标签思维(2)
- HDU6077 2017杭电多校联赛第四场-Time To Get Up
- 解决Android7.0系统 调用系统相机、系统播放器播放视频、切图兼容问题,报异常android.os.FileUriExposedException
- Java并发编程的艺术(七)——Executors
- mysql零基础入门视频教程免费分享!
- LightOJ
- pinerest界面分析,供抓取
- HDU6077 思维(水)
- Java web项目Linux下部署的中文乱码问题
- JAVA多态的理解
- Android学习笔记 Lambda for Android
- 指针与数组的基础知识分析
- Webpack创建、运行vue.js项目
- LightOJ 1422 Halloween Costumes(区间DP)
- 修改Hibernate源码实现建表时字段和Entity里定义的fields顺序一致
- 简简单单进行pdf转cad操作