POJ1222
来源:互联网 发布:阿里云服务器公网ip 编辑:程序博客网 时间:2024/05/22 10:36
熄灯问题,枚举问题
只需枚举第一行
#include "iostream"using namespace std;const int N = 64;int Bubble[7][8];int Action[7][8];bool GetAnswer(void){for(int Row = 1 ; Row != 5 ; Row ++){for (int Col = 1 ; Col != 7 ; Col ++){Action[Row + 1][Col] = ( Action[Row][Col] + Action[Row][Col - 1] + Action[Row - 1][Col] + Action[Row][Col + 1] + Bubble[Row][Col] ) % 2;}}for ( int Col = 1 ; Col != 7 ; Col ++ ){if ( ( Action[5][Col] + Action[5][Col - 1] + Action[4][Col] + Action[5][Col + 1] + Bubble[5][Col] ) % 2 != 0 ){return false;}}return true;}void SetFirstLine(void){for (int i = 1 ; i != 7 ; i ++){Action[1][i] = 0;}for (int i = 0 ; i != N ; i ++ ){int Test = i;int Bita = 1;while(Test != 0){Action[1][Bita ++] = Test % 2;Test /= 2;}if(GetAnswer() == true)break;}}int main(void){int Case,Count = 0;cin >> Case;while(Case --){for ( int i = 1 ; i != 6 ; i ++ ){for ( int j = 1 ; j != 7 ; j ++ ){cin >> Bubble[i][j];}}SetFirstLine();Count ++;cout << "PUZZLE #" << Count << endl;for ( int i = 1 ; i != 6 ; i ++ ){for ( int j = 1 ; j != 7 ; j ++ ){cout << Action[i][j] << " ";}cout << endl;}}return 0;}
- POJ1222
- poj1222
- poj1222
- POJ1222
- POJ1222
- poj1222
- POJ1222
- poj1222
- POJ1222(高斯消元)
- POJ1222高斯消元
- poj1222 高斯消元
- poj1222 高斯消元
- poj1222高斯消元基础题
- poj1222(暴力枚举)
- 反转问题--poj1222
- poj1222 枚举 和 高斯消元
- poj1222 EXTENDED LIGHTS OUT
- POJ1222 EXTENDED LIGHTS OUT
- 桥接模式(Bridge)
- POJ1207
- 舵机知识扫盲
- POJ 1386 (欧拉路径+并查集)
- 九度 题目1093:WERTYU
- POJ1222
- linux调度器(七)——other cfs class api and functions
- linux调度器(八)——实时调度与SMP
- [SGU]139. Help Needed!
- Windows Phone的应用程序认证要求
- linux调度器(九)——调度器的配置参数
- POJ1247
- linux调度器(十)——调度器/proc信息解读
- mvc4 membership table