UVALive - 6269 Digital Clock 模拟
题意:时钟坏了,给你一段连续的时间,问你现在可能的时间是多少。
思路:直接模拟,他妈的居然这场就跪在了这题,卧槽,他妈的就在111行,居然多打了个 = ,这是什么意思,注孤生吗
#pragma comment(linker, "/STACK:1000000000")
#include <bits/stdc++.h>
#define LL long long
#define INF 0x3f3f3f3f
#define IN freopen("d.in","r",stdin);
#define OUT freopen("out.txt","w",stdout);
using namespace std;
#define MAXN 9999
int w[][], y[][];
bool first;
struct Node{
bool vis[];
Node(int x){
memset(vis, , sizeof(vis));
if(x != && x != ){
vis[] = true;
}
if(x != && x != && x != && x != ){
vis[] = true;
}
if(x != && x != ){
vis[] = true;
}
if(x != && x != && x != ){
vis[] = true;
}
if(x == || x == || x == || x == ){
vis[] = true;
}
if(x != ){
vis[] = true;
}
if(x != && x != && x != ){
vis[] = true;
}
}
}; struct Moment{
int hour, mi;
int u[];
Moment(int i = ){
hour = i / ;
mi = i % ;
u[] = hour / ;
u[] = hour % ;
u[] = mi / ;
u[] = mi % ;
}
void print(){
if(first){
printf("%d%d:%d%d", u[], u[], u[], u[]);
first = false;
}
else{
printf(" %d%d:%d%d", u[], u[], u[], u[]);
}
}
};
bool work(char *s, int x){
Moment t = Moment(x);
memset(w, , sizeof(w));
for(int i = ; i < ; i++){
if(i == ) continue;
Node p = Node(s[i] - '');
Node q = Node(t.u[i]);
for(int j = ; j <= ; j++){
if(!p.vis[j] && q.vis[j]){
w[i][j] = ;
continue;
}
if(p.vis[j] && !q.vis[j]){
return false;
}
if(p.vis[j] && q.vis[j]){
w[i][j] = ;
}
}
}
return true;
} bool work_y(char *s, int x){
Moment t = Moment(x);
memset(y, , sizeof(y));
for(int i = ; i < ; i++){
if(i == ) continue;
Node p = Node(s[i] - '');
Node q = Node(t.u[i]);
for(int j = ; j <= ; j++){
if(!p.vis[j] && q.vis[j]){
y[i][j] = ;
continue;
}
if(p.vis[j] && !q.vis[j]){
return false;
}
if(p.vis[j] && q.vis[j]){
y[i][j] = ;
}
}
}
return true;
}
bool check(){
for(int i = ; i < ; i++){
if(i == ) continue;
for(int j = ; j <= ; j++){
if(y[i][j] == ) continue;
if(w[i][j] == && y[i][j] != ){
w[i][j] = y[i][j];
continue;
}
if(w[i][j] == && y[i][j] == ){
return false;
}
if(w[i][j] == && y[i][j] == ){
return false;
}
}
}
return true;
}
char s[][];
int main()
{
//IN;
//OUT;
int n;
int cas = ;
while(~scanf("%d", &n)){
if(cas == ){
int o = ;
o = + ;
}
cas++;
for(int i = ; i <= n; i++){
scanf("%s", s[i]);
}
Moment t;
first = true;
for(int i = ; i < ; i++){
if( i == ){
int o;
o = + ;
}
if(!work(s[], i)) continue;
bool flag = false;
for(int j = ; j <= n; j++){
if(i + j - == ){
int o;
o = + ;
}
if(!work_y(s[j], (i + j - ) % )){
flag = true;
break;
}
if(check()) continue;
flag = true;
break;
}
if(flag) continue;
t = Moment(i);
t.print();
}
if(first){
printf("none\n");
}
else{
printf("\n");
}
}
return ;
}
UVALive - 6269 Digital Clock 模拟的更多相关文章
- UVALive 6269 Digital Clock --枚举,模拟
题意:说不清楚,自己看吧,太恶心. 这题真是SB了,当时看了一下以为乱搞就好了,于是开始动手拍,结果拍了好几个小时都没拍出来,而且越想越想不通,直接把自己绕进去了,结果gg了. 总结:甭管什么题,想清 ...
- digital clock based C
/********************************** * Name : timeDisplay.cpp * Purpose: Display digital clock accord ...
- ZOJ 1122 Clock(模拟)
Clock Time Limit: 2 Seconds Memory Limit: 65536 KB You are given a standard 12-hour clock with ...
- UVALive - 7139(差分+模拟)
题目链接 参考 题意 N*M的网格,一辆车沿着网格线按给定路线走,每个网格里有一个人,人的视线始终看着车,问这些人净转圈数的平方和. 分析 由于车的起点和终点都为左上角,且每个格子里的人永远面对着车, ...
- UVALive 7464 Robots(模拟)
7464Robots Write a program to collect data from robots. We are given two sets of robotsX=fX1;:::;Xmg ...
- HDU 5705 Clock(模拟,分类讨论)
Clock Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submi ...
- 【Bit String Reordering UVALive - 6832 】【模拟】
题意分析 题目讲的主要是给你一个01串,然后给你要变成的01串格式,问你要转换成这一格式最少需要移动的步数. 题目不难,但当时并没有AC,3个小时的个人赛1道没AC,归根到底是没有逼自己去想,又想的太 ...
- 【Miscalculation UVALive - 6833 】【模拟】
题目分析 题目讲的是给你一个串,里面是加法.乘法混合运算(个人赛中误看成是加减乘除混合运算),有两种算法,一种是乘法优先运算,另一种是依次从左向右运算(不管它是否乘在前还是加在前). 个人赛中试着模拟 ...
- UVaLive 6809 Spokes Wheel (模拟)
题意:给定两个16进制数,问你把它转成二进制后,把第一个向左或者向右旋转最少的次数同,使得第一个变成第二个. 析:也是比较水的,按照要求做就好,注意0的情况,可能会忘记. #pragma commen ...
随机推荐
- react-native 运行提示红屏 error: bundling failed: ambiguous resolution: module `/User/xxx/Project/ico/index.js` tries to require `react-native`, but there are several files providing this module. You can de
运行 react-native start 报错 执行这2个进行清除缓存问题 yarn start -- --reset-cache npm start -- --reset-cache
- OpenJDK源码研究笔记(五)-缓存Integer等类型的频繁使用的数据和对象,大幅度提升性能(一道经典的Java笔试题)
摘要 本文先给出一个看似很简单实则有深意的Java笔试面试题,引出JDK内部的缓存. JDK内部的缓存,主要是为了提高Java程序的性能. 你能答对这道"看似简单,实则有深意"的J ...
- Docker学习总结(9)——Docker常用命令
容器生命周期管理 - docker [run|start|stop|restart|kill|rm|pause|unpause] 容器操作运维 - docker [ps|inspect|top|att ...
- HDU——T 2444 The Accomodation of Students
http://acm.hdu.edu.cn/showproblem.php?pid=2444 Time Limit: 5000/1000 MS (Java/Others) Memory Limi ...
- 在VS2013中配置QT5 win7_64
转自 在VS2013中配置QT5 win7_64 环境: win x64 + vs2013+QT5+vs_addin 下面示例正确配置QT以及VS2013 + QT Addin开发环境: 下载VS20 ...
- 转:app store 注册账号生成证书上传app完整的教程
app store为开发者提供四种类型的申请: 个人ios开发者计划$99/年 公司ios开发者计划$99/年 企业ios开发者计划$299/年 高校ios开发者计划免费 在这里主要介绍一下公司ios ...
- sass04 嵌套、继承、占位符
demo1.scss body{ //选择器嵌套 background-color:lightgray; header{ background-color:lightgreen; } footer{ ...
- Random numbers
Most computer programs do the same thing every time they execute, given the same inputs, so they are ...
- 基于JS的身份证验证(完整版)
var Wi = [ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1 ]; // 加权因子 var ValideCode = [ 1, 0 ...
- spinlock参考资料
spinlock:http://irl.cs.ucla.edu/~yingdi/web/paperreading/smp_locking.pdf