在遥远的西方有一个古老的王国,国王将他的王国分成了网格状,每一块称之为一个城市。在国王临死前,他将这些城市分给了自己的N个儿子(编号为0到N-1)。然而这N个王子的关系不是很好,0讨厌1,1讨厌2,2讨厌3……N-1讨厌0。在国王死后,这种不好的关系使得王子之间爆发了...
转载 2017-10-24 08:03:00
27阅读
2评论
Description在遥远的西方有一个古老的王国,国
原创 2022-12-26 18:36:05
58阅读
#include #include #include using namespace std; int mem[4][4];//用于储存翻转次数,如果是偶数,则相当于没有翻转 int main(){ char ch; for (int x = 0; x<4; x++){//按sample的顺序,x代表纵行,y是横列 for (int y = 0; y <= 4;...
qt
原创 2021-07-15 15:06:42
44阅读
在遥远的西方有一个古老的王国,国王将他的王国分成了网格状,每一块称之为一个城市。在国王临死前,他将这些城市分给了自己的N个儿子(编号为0到N-1)。然而这N个王子的关系不是很好,0讨厌1,1讨厌2,2讨厌3……N-1讨厌0。在国王死后,这种不好的关系使得王子之间爆发了...
转载 2017-10-24 08:03:00
17阅读
2评论
//参照 poj8 1753 Flip Game#include<iostream> //bfs+位运算 #include <stdio.h>#include <stack>using namespace std;const int mod=0x55555555; //mod=(0101 0101 0101 0101 0101 0101 0101 0101)十六进制,实际上是16,4*4个 01 int fac[4][4]={{1,4,16,64},{256,1024,4096,16384},{65536,262144,1048576,4194304},{1
转载 2011-07-06 11:11:00
40阅读
【题目链接】 http://poj.org/problem?id=2965 【算法】 位运算 【代码】
转载 2018-06-28 19:01:00
63阅读
2评论
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 19356 Accepted: 7412 Special Judge Description The game “
转载 2016-04-07 14:37:00
111阅读
2评论
#题目传送门 ##题意 给定一个$4\times 4$的棋盘,每个格子有开启和关闭两种状态,每次选择一个格子,同时改变当前格子所处的行和列的所有状态,问需要几步才能将所有格子的状态变成开启,并输出每次选择的格子。 ##思路 本题与POJ-1753Flip Game 枚举类似,由于只有16个格子,我们 ...
转载 2021-08-11 15:11:00
101阅读
2评论
  The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 18080   Accepted: 6855   Special Judge   Description The game “The Pilots Brothers: following the st
转载 2017-04-28 19:47:00
62阅读
2评论
[POJ2965]The Pilots Brothers' refrigerator 试题描述 The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open
转载 2016-11-24 19:18:00
43阅读
2评论
POJ 2965.The Pilots Brothers’ refrigeratorIdeas题意:给你4*4的矩阵。每个点有两种状态,+代表关,-代表开。每个点有一个操作就是该点所在行列所有状态翻转。问最少多少次可以打开全部开关,并且输出最少个数情况下翻转的点。先梳理一下题目给的测试样例的操作步骤:首先需要知道一点:一个开关翻转偶数次状态不变,翻转奇数次状态改变。(奇变偶不变)然后再深入一步:要使一个为+的符号变为-,必须其相应的行和列的操作数为奇数。如果+位置对应的行和列上每一个位置都进行
原创 2022-01-04 14:12:55
130阅读
Description The game “The Pilots Brothers: following the stripy elephant” has a quest where
原创 2022-08-10 10:29:19
33阅读
题目地址:http://poj.org/problem?id=2965 1 /* 2 题意:4*4的矩形,改变任意点,把所有'+'变成'-',,每一次同行同列的都会反转,求最小步数,并打印方案 3 4 DFS:把'+'记为1, '-'记为0 5 1. 从(1, 1...
转载 2015-03-27 16:24:00
47阅读
2评论
The Pilots Brothers’ refrigerator (DFS&思维)思路1:与POJ−1753POJ-1753POJ−1753类似,位运算dfsdfsdfs搜,不过容易超时。#include<iostream>#include<cstdio>#include<cmath>#include<algorithm>#include<vector>using namespace std;typedef long lo
原创 2022-01-21 11:50:20
6阅读
这题的思路非常值得深思 先考虑这种情况 -+-- -+-- ++++ -+-- 用一个数组vis作标记数组 然后遍历所有的+的位置,将+所在的行和列的vis都翻转(0变1,1变0),那么会怎样呢? 首先肯定可以证明,翻转偶数次和没翻转是一样的,翻转只分奇数次和偶数次就够了 先看左上角,左下角,右上角,右下角,这4块会同时受到行和列+号的影响,所以抵消了不变
原创 2022-11-24 00:01:04
34阅读
The Pilots Brothers’ refrigerator (DFS&思维)思路1:与POJ−1753POJ-1753POJ−1753类似,位运算dfsdfsdfs搜,不过容易超时。#include<iostream>#include<cstdio>#include<cmath>#include<algorithm>#include<vector>using namespace std;typedef long lo
原创 2021-08-10 09:48:04
24阅读
Description The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a refrigerator. There are 16 handles on the refrigerator door. Every handle c
原创 2023-04-14 00:11:18
58阅读
The Pilots Brothers' refrigeratorTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 16868Accepted: 6393Special JudgeDescriptionThe game “The Pil...
转载 2014-02-13 14:04:00
78阅读
2评论
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 18040 Accepted: 6841 Special Judge Description The game “
转载 2017-07-28 19:12:00
97阅读
2评论
I - The Pilots Brothers' refrigerator Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Description The game “The Pil
转载 2017-05-17 20:37:00
48阅读
2评论
  • 1
  • 2
  • 3
  • 4