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 ...
随机推荐
- 安装 glusterfs yum源报错
yum install glusterfs-server yum 一直报错 把/etc/yum.repos.d 备份 删除了所有文件,从测试机192..168.59.128上同步过来 一直报错 已加载 ...
- java后台生成图片二维码
controller: /** * 获取登录的验证码 * @param request * @param response */ public void getLoginCode(HttpSessio ...
- Android群英传-拼图游戏puzzle-6点吐槽
一.缘由 经常写文章,混了一些C币.最近在深入学习Android应用开发,就从商城里买了一本<Android群英传>.这本书的内容,不是纯粹的入门那种,分几个章节,重点讲解Activit ...
- GenIcam标准(四)
2.8.可用的节点类型 本章对每个可用的节点类型提供一个概要的描述,包括其功能.用途以及最关心的参数.另外,对于每个节点在GenICam标准的XML格式文件中的layout,会有一个正式的说明.这个格 ...
- HDU 2782 The Worm Turns (DFS)
Winston the Worm just woke up in a fresh rectangular patch of earth. The rectangular patch is divide ...
- RubyMine2017破解
RubyMine2017破解 学习了:https://www.7down.com/soft/172903.html 激活的时候选择 license server; 输入如下地址激活: http://i ...
- Flex 远程视频监控观看端新版
第一个版本号仅仅做了预览这一块 http://blog.csdn.net/songanling/article/details/38306037,后面老板看了认为色调太暗.看得不舒服,然后就開始又一次 ...
- zoj 3820 Building Fire Stations (二分+树的直径)
Building Fire Stations Time Limit: 5 Seconds Memory Limit: 131072 KB Special Judge Marjar ...
- [转]60fps on the mobile web
Flipboard launched during the dawn of the smartphone and tablet as a mobile-first experience, allowi ...
- 安卓通过Json注册登录
对于刚开始做安卓的来说,可能一个好的Demo比什么都来得快,但是最近在做安卓登录注册的时候,发现基本找不到我想要的东西,无奈只好硬着头皮做,好在不负付出,终于搞定,也算是给自己一个交待. 从结构上说, ...