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 模拟的更多相关文章

  1. UVALive 6269 Digital Clock --枚举,模拟

    题意:说不清楚,自己看吧,太恶心. 这题真是SB了,当时看了一下以为乱搞就好了,于是开始动手拍,结果拍了好几个小时都没拍出来,而且越想越想不通,直接把自己绕进去了,结果gg了. 总结:甭管什么题,想清 ...

  2. digital clock based C

    /********************************** * Name : timeDisplay.cpp * Purpose: Display digital clock accord ...

  3. ZOJ 1122 Clock(模拟)

    Clock Time Limit: 2 Seconds      Memory Limit: 65536 KB You are given a standard 12-hour clock with ...

  4. UVALive - 7139(差分+模拟)

    题目链接 参考 题意 N*M的网格,一辆车沿着网格线按给定路线走,每个网格里有一个人,人的视线始终看着车,问这些人净转圈数的平方和. 分析 由于车的起点和终点都为左上角,且每个格子里的人永远面对着车, ...

  5. UVALive 7464 Robots(模拟)

    7464Robots Write a program to collect data from robots. We are given two sets of robotsX=fX1;:::;Xmg ...

  6. HDU 5705 Clock(模拟,分类讨论)

    Clock Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submi ...

  7. 【Bit String Reordering UVALive - 6832 】【模拟】

    题意分析 题目讲的主要是给你一个01串,然后给你要变成的01串格式,问你要转换成这一格式最少需要移动的步数. 题目不难,但当时并没有AC,3个小时的个人赛1道没AC,归根到底是没有逼自己去想,又想的太 ...

  8. 【Miscalculation UVALive - 6833 】【模拟】

    题目分析 题目讲的是给你一个串,里面是加法.乘法混合运算(个人赛中误看成是加减乘除混合运算),有两种算法,一种是乘法优先运算,另一种是依次从左向右运算(不管它是否乘在前还是加在前). 个人赛中试着模拟 ...

  9. UVaLive 6809 Spokes Wheel (模拟)

    题意:给定两个16进制数,问你把它转成二进制后,把第一个向左或者向右旋转最少的次数同,使得第一个变成第二个. 析:也是比较水的,按照要求做就好,注意0的情况,可能会忘记. #pragma commen ...

随机推荐

  1. Mean, Median, Mode, Range, and Standard Deviation

    Descriptive statistics tell you about the distribution of data points in data set. The most common m ...

  2. Springboot+swagger2的接口文档开发

    一.创建一个SpringBoot项目 1. 2. 3. 4. 把web里的web选中,SQL里选择自己需要的,点击next 二.创建各项所需的controller,configure等 1. 项目布局 ...

  3. mariadb数据库的链接查询和表格设计

    链接查询 练习准备: --创建学生表 create table students ( id int unsigned not null auto_increment primary key, name ...

  4. hadoop 多文件夹输入,map到reduce怎样排序

    使用MultipleInputs.addInputPath 对多个路径输入 如今如果有三个文件夹,并使用了三个mapper去处理, 经过map处理后,输出的结果会依据key 进行join, 假设使用T ...

  5. []HAOI2008] 硬币购物 解题报告 ( 完全背包+容斥原理)

    题目链接:https://www.luogu.org/problemnew/show/P1450 题目描述: 题解: 如果去掉限制的话,这就是一个完全背包. 我们可以考虑先去掉限制,把这个完全背包做出 ...

  6. [洛谷P1169] [ZJOI2007] 棋盘制作 解题报告(悬线法+最大正方形)

    题目描述 国际象棋是世界上最古老的博弈游戏之一,和中国的围棋.象棋以及日本的将棋同享盛名.据说国际象棋起源于易经的思想,棋盘是一个 8×8 大小的黑白相间的方阵,对应八八六十四卦,黑白对应阴阳. 而我 ...

  7. 桌面出现removable storage devices文件夹无法删除解决办法

    今天桌面突然出现 removable storage devices 文件夹,且没有删除选项. 解决办法:往电脑里插一下u盘文件夹就会自动消失了.

  8. Bootstrap modal.js 源码分析

    /* ======================================================================== * Bootstrap: modal.js v3 ...

  9. RSA不对称加密

    package sinRsa; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io ...

  10. 记intel杯比赛中各种bug与debug【其一】:安装intel caffe

    因为intel杯创新软件比赛过程中,并没有任何记录.现在用一点时间把全过程重演一次用作记录. 学习 pytorch 一段时间后,intel比赛突然不让用 pytoch 了,于是打算转战intel ca ...