保存不完整数字可能对应的数字,注意小时<24,分钟小于59.

AC代码

#include <stdio.h>
#include <vector>
using namespace std;
const int maxn = + ;
char s[][maxn];
int ret[maxn], tol;
vector<int> a[];
int h, m;
char dig[][] = {
' ','_',' ','|',' ','|','|','_','|',
' ',' ',' ',' ',' ','|',' ',' ','|',
' ','_',' ',' ','_','|','|','_',' ',
' ','_',' ',' ','_','|',' ','_','|',
' ',' ',' ','|','_','|',' ',' ','|',
' ','_',' ','|','_',' ',' ','_','|',
' ','_',' ','|','_',' ','|','_','|',
' ','_',' ',' ',' ','|',' ',' ','|',
' ','_',' ','|','_','|','|','_','|',
' ','_',' ','|','_','|',' ','_','|'}; void dfs(int num) {
if(num >= ) {
int x = (ret[]* + ret[])* + (ret[]*+ret[]);
int y = (ret[]* + ret[])* + (ret[]*+ret[]);
if(x > *+ || y > *+) {
return;
}
if((y+) % (*) == x) {
//printf("%d : %d %d : %d\n", ret[0]*10+ret[1],ret[2]*10+ret[3],ret[4]*10 + ret[5],ret[6]*10+ret[7]);
h = ret[]* + ret[];
m = ret[]*+ret[];
tol++;
}
return;
}
if(tol > ) return;;
for(int i = ; i < a[num].size(); i++) {
ret[num] = a[num][i];
dfs(num+);
}
} int main() {
int T;
scanf("%d", &T);
getchar();
while(T--) {
tol = ;
for(int i = ; i < ; i++) a[i].clear();
for(int i = ; i < ; i++) {
fgets(s[i], sizeof(s[i]), stdin);
}
int num = ;
for(int i = ; i < *+; i+=) {
if(i==) {
i = ;
continue;
}
vector<char> b;
for(int j = ; j < ; j++) {
for(int k = i; k < i+; k++) {
b.push_back(s[j][k]);
}
}
// compare
for(int j = ; j < ; j++) {
int f = ;
for(int k = ; k < ; k++) {
if(dig[j][k] != b[k] && (b[k] == '_' || b[k] == '|')) f = ;
}
if(f) {
if(num % == ) {
if(j <= ) a[num].push_back(j);
}else if(num % == ) {
if(j <= ) a[num].push_back(j);
}else {
a[num].push_back(j);
}
}
}
num++;
}
dfs();
if(tol != ) printf("Not Sure\n");
else printf("%02d%02d\n", h, m);
}
return ;
}

如有不当之处欢迎指出!

poj1676的更多相关文章

  1. poj1676(转换为二进制求解)

    题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=13175 题目关键:将0~9十个数转换为二进制数进行枚举比较 int ...

  2. OJ题目分类

    POJ题目分类 | POJ题目分类 | HDU题目分类 | ZOJ题目分类 | SOJ题目分类 | HOJ题目分类 | FOJ题目分类 | 模拟题: POJ1006 POJ1008 POJ1013 P ...

随机推荐

  1. 【actitivi】配置运行上遇到的问题

    基础: 需要 问题1:对于activiti-admin,添加mysql-connector-java-5.1.47.jar后: Sun Apr 28 16:09:00 CST 2019 WARN: E ...

  2. HTML元素解释

    <html> 与 </html> 之间的文本描述网页 <body> 与 </body> 之间的文本是可见的页面内容 <head> 与 < ...

  3. Leetcode: Find Permutation(Unsolve lock problem)

    By now, you are given a secret signature consisting of character 'D' and 'I'. 'D' represents a decre ...

  4. nginx----------前端写了一套带有vue路由的的功能。放到nginx配置的目录下以后,刷新会报404未找到。

    1. 这是根据实际情况来写的. location /h5/activity/wechat/ {            index  index.html index.htm index.php;    ...

  5. jenkins+Gitlab+maven+tomcat实现自动集成、打包、部署

    一.前言 首先出于提高自己技术水平和琢磨能做点什么能提高工作效率,上线工作实在无聊.重复(手动编译.打包,传包,重启),于是就想到了jenkins,jenkins持续集成已经不是什么新鲜的话题,网上文 ...

  6. java-redis

    pom.xml添加如下配置: <dependency> <groupId>org.springframework.boot</groupId> <artifa ...

  7. spring boot 整合js css 静态文件

    一,添加配置 spring: application: name: interview-server resources: static-locations: file:config/statics ...

  8. nginx + keepalived 主从模式

    转自:https://www.cnblogs.com/kevingrace/p/6138185.html 负载均衡技术对于一个网站尤其是大型网站的web服务器集群来说是至关重要的!做好负载均衡架构,可 ...

  9. vue学习笔记—bootstrap+vue用户管理

    vue,读音view,简单易用的前端框架.特点如下: 1.一个mvvm的前端框架,内部做好了html中dom对象和后台用js语言定义的变量的双向绑定 2.中国人尤雨溪维护的个人项目,中文资料多,和go ...

  10. 【shell】shuf命令提取文件的随机行

    shuf命令可以随机提取一个文本文件的不同行,输出到文件或者标准输出中. shuf 用法: shuf [选项]... [文件] 或者: shuf -e [选项]... [参数]... 或者: shuf ...