USACO 1.4 The Clocks (暴力枚举)
来源:互联网 发布:银背大猩猩战斗力知乎 编辑:程序博客网 时间:2024/05/16 09:56
#include <stdio.h>#define DEBUG 0#define TESTCASES 9#define CLOCKS 9#define MOVES 9#define FOR(index, size) for ((index) = 0; (index) < (size); (index)++)int initialState[CLOCKS];int arrayOfMove[MOVES][CLOCKS] = { {3, 3, 0, 3, 3, 0, 0, 0, 0}, {3, 3, 3, 0, 0, 0, 0, 0, 0}, {0, 3, 3, 0, 3, 3, 0, 0, 0}, {3, 0, 0, 3, 0, 0, 3, 0, 0}, {0, 3, 0, 3, 3, 3, 0, 3, 0}, {0, 0, 3, 0, 0, 3, 0, 0, 3}, {0, 0, 0, 3, 3, 0, 3, 3, 0},{0, 0, 0, 0, 0, 0, 3, 3, 3}, {0, 0, 0, 0, 3, 3, 0, 3, 3} };int timesOfMove[MOVES];int main(){#if DEBUGint testCase;for (testCase = 1; testCase <= TESTCASES; testCase++){char inputFileName[20] = "inputX.txt";inputFileName[5] = '1' + (testCase - 1);freopen(inputFileName, "r", stdin);printf("\n#%d\n", testCase);#endifint clock;FOR(clock, CLOCKS)scanf("%d", &initialState[clock]);int state;FOR(timesOfMove[0], 4)FOR(timesOfMove[1], 4)FOR(timesOfMove[2], 4)FOR(timesOfMove[3], 4)FOR(timesOfMove[4], 4)FOR(timesOfMove[5], 4)FOR(timesOfMove[6], 4)FOR(timesOfMove[7], 4)FOR(timesOfMove[8], 4){int fail = 0;FOR(clock, CLOCKS){state = initialState[clock];int move;FOR(move, MOVES)state += arrayOfMove[move][clock] * timesOfMove[move];if (state % 12 != 0){fail = 1;break;}}//end of FOR(clock, CLOCKS)if (fail == 0){int move;FOR(move, MOVES){int times = timesOfMove[move];while (times > 0){printf("%d%c", move + 1, move == MOVES - 1 && times == 1 ? '\n' : ' ');times--;}}}}//end of FOR(timesOfMove[8], 4)#if DEBUG}#endifreturn 0;}
0 0
- USACO 1.4 The Clocks (暴力枚举)
- USACO 1.4 The Clocks (clocks)
- USACO 1.4-The Clocks
- USACO 1.4 The Clocks
- USACO 1.4 The Clocks (位操作+枚举+DFS)
- USACO 1.4 The Clocks (位操作+枚举+BFS)
- USACO Section 1.4 The Clocks (clocks)
- USACO/The Clocks(DFS,BFS,枚举)
- poj 1166 The Clocks 暴力枚举
- [USACO 1.4.2] The Clocks
- USACO 1.4.2 The Clocks
- USACO Section 1.4 The Clocks
- USACO 1.4.2 The Clocks
- Usaco 1.4.2 时钟(The Clocks)
- USACO section 1.4.2 The Clocks
- USACO 1.4.2 The Clocks(DFS)
- USACO Section 1.4.3 The Clocks
- 【USACO题库】1.4.2 The Clocks
- android中一个与智能机器人问答的简单程序
- 一维数组的探索
- WordPress性能优化
- Java 虚拟机中的存储的理解 堆栈 GC
- 50. 别逗我了,好吧!
- USACO 1.4 The Clocks (暴力枚举)
- A013-animator资源
- PHP中SQL注入解析
- rm命令切换
- 节点管理器启动报错
- Single Number III
- HDU 5455 Fang Fang
- 你以为你在合群,其实你在浪费青春
- HDU 5452 Minimum Cut