poj 1166 The Clocks
来源:互联网 发布:return python 怎么写 编辑:程序博客网 时间:2024/06/06 03:21
题意我就没读懂...
百度才知道是给了九只钟
又给了九种调钟的方式
每种方式中给出了调节那几个钟
每次调节15°
直接暴力...这里用了宏定义,代码省了很多啊
代码如下:
#include <cstdio>#include <iostream>#include <algorithm>#define MAXN 10010#define LL long long#define f(i) for(a[i]=0; a[i]<4; ++a[i])#define ff(x) for(int j=0; j<a[x]; ++j)using namespace std;int g[10], ans[10], a[10], tmp[10];int cnt;//a[n]记载的是第n种方案调用的次数int main(void) { for(int i=1; i<=9; ++i) scanf("%d", &g[i]); f(1)f(2)f(3)f(4)f(5)f(6)f(7)f(8)f(9) { ans[1] = (g[1]+a[1]+a[2]+a[4])%4; ans[2] = (g[2]+a[1]+a[2]+a[3]+a[5])%4; ans[3] = (g[3]+a[2]+a[3]+a[6])%4; ans[4] = (g[4]+a[1]+a[4]+a[5]+a[7])%4; ans[5] = (g[5]+a[1]+a[3]+a[5]+a[7]+a[9])%4; ans[6] = (g[6]+a[3]+a[5]+a[6]+a[9])%4; ans[7] = (g[7]+a[4]+a[7]+a[8])%4; ans[8] = (g[8]+a[5]+a[7]+a[8]+a[9])%4; ans[9] = (g[9]+a[6]+a[8]+a[9])%4; int tot = 0; for(int i=1; i<=9; ++i) tot += ans[i]; if(tot == 0) { for(int i=1; i<=9; ++i) { ff(i) cout << i << " "; } cout << endl; return 0; } }}
0 0
- POJ 1166 The clocks
- POJ 1166 The Clocks
- POJ 1166 The Clocks
- POJ 1166 The Clocks
- poj 1166 The Clocks
- POJ 1166 The Clocks
- poj 1166 The Clocks
- poj 1166 The Clocks
- poj 1166 The Clocks
- poj The Clocks 1166
- POJ 1166 The Clocks
- POJ 1166:The Clocks
- POJ 1166 The Clocks
- POJ The Clocks 1166
- POJ 1166 The Clocks 笔记
- Poj-1166-The Clocks-枚举
- POJ 1166 The Clocks(暴力搜索)
- poj 1166 The Clocks 暴力枚举
- Java类库中的设计模式
- Windows进程间通信的各种方法
- 模拟运算放大器的原理、选用原则和实际应用
- 正则表达式matcher.group用法
- Java获取进程列表的方法
- poj 1166 The Clocks
- 让面试官对你“一见钟情”
- 存储过程
- 禁止入内的内存引用和缓冲区溢出
- HDU 1518 Square(DFS)
- 进程创建fork与exce示例
- HDU 2544 最短路
- Entity Framework 乐观并发控制
- HTML初学---超链接(链接)