| Time Limit: 1000MS | Memory Limit: 65536K | |||
| Total Submissions: 20362 | Accepted: 7844 | Special Judge | ||
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 can be in one of two states: open or closed. The refrigerator is open only when all handles are open. The handles are represented as a matrix 4х4. You can change the state of a handle in any location [i, j] (1 ≤ i, j ≤ 4). However, this also changes states of all handles in row i and all handles in column j.
The task is to determine the minimum number of handle switching necessary to open the refrigerator.
Input
The input contains four lines. Each of the four lines contains four characters describing the initial state of appropriate handles. A symbol “+” means that the handle is in closed state, whereas the symbol “−” means “open”. At least one of the handles is initially closed.
Output
The first line of the input contains N – the minimum number of switching. The rest N lines describe switching sequence. Each of the lines contains a row number and a column number of the matrix separated by one or more spaces. If there are several solutions, you may give any one of them.
Sample Input
-+-- ---- ---- -+--
Sample Output
6 1 1 1 3 1 4 4 1 4 3 4 4/* **实际这个题与1753非常类似,只是在1753代码基础上加上几步处理 */ #include <iostream> #include <cstring> #include <cstdio> using namespace std; bool vis[5][5] = {{false}}; bool flag = false; int step; int xx[16],yy[16]; bool Judge() { for(int i=1;i<=4;i++) { for(int j=1;j<=4;j++) { if(!vis[i][j]) return false; } } return true; } void Flip(int x,int y) { vis[x][y] = !vis[x][y]; for(int i=1;i<=4;i++) { vis[x][i] = !vis[x][i]; vis[i][y] = !vis[i][y]; } } void DFS(int x,int y,int deep) { if(deep == step) { flag = Judge(); return ; } if(flag || y == 5) return ; Flip(x,y); xx[deep] = x; yy[deep] = y; if(x < 4) DFS(x+1,y,deep+1); else DFS(1,y+1,deep+1); Flip(x,y); if(x < 4) DFS(x+1,y,deep); else DFS(1,y+1,deep); } int main() { // freopen("in.txt","r",stdin); char ch; for(int i=1; i<=4; i++) { for(int j=1; j<=4; j++) { cin>>ch; if(ch == '-') vis[i][j] = true; } } for(step=1; step<=16; step++) { DFS(1,1,0); if(flag) break; } cout<<step<<endl; for(int i=0; i<step; i++) cout<<xx[i]<<" "<<yy[i]<<endl; return 0; }
本文深入探讨了游戏开发领域的关键技术,包括cocos2dX、unity3d等游戏引擎的应用,以及大数据处理技术如Hadoop、Spark在游戏行业的应用案例。详细介绍了游戏引擎在增强现实(AR)、虚拟现实(VR)等方面的功能与优势,同时阐述了大数据在游戏性能优化、用户行为分析等场景中的价值。
301

被折叠的 条评论
为什么被折叠?



