摘要: 这个不解释了吧,提交后看了下后台数据,相当的大啊。。。 1 /* ID:linyvxi1 2 PROB:numtri 3 LANG:C++ 4 */ 5 #include <stdio.h> 6 #include <math.h> 7 #include <stdlib.h> 8 int max(int a,int b) 9 {10 return a>b?a:b;11 }12 int num_map[1001][1001];13 int main()14 {15 freopen("numtri.in","r",st 阅读全文
posted @ 2012-02-08 21:56 linyvxiang 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 还是感觉枚举好,搜索啥的越想越麻烦。因为表是圆的,每个表转四下会回到原来的位置,所以,对于每个表,最多转3次,或者不转,也就是说,对于9个表,每个表有四种可能,那么,一共有4^9种可能,依次枚举,第一个符合条件的即是最小的 1 /* ID:linyvxi1 2 PROB:clocks 3 LANG:C++ 4 */ 5 #include <stdio.h> 6 #include<string> 7 #include<algorithm> 8 using namespace std; 9 10 int ans[10], num[10], tmp[10];11 阅读全文
posted @ 2012-02-08 18:42 linyvxiang 阅读(226) 评论(0) 推荐(0) 编辑
摘要: DFS最容易理解,visited[A][B][C]表示a,b,c三桶此种状态有没有被搜索过,ans存放符合条件时,c桶的状态。对于每一个状态,下一状态有六种可能,详见代码中注释 1 /* 2 ID:linyvxi1 3 PROG:milk3 4 LANG:C++ 5 */ 6 #include <stdio.h> 7 #include <algorithm> 8 #include <stdlib.h> 9 #include <string.h>10 using namespace std;11 long ans[50],p=-1;12 long 阅读全文
posted @ 2012-02-08 14:25 linyvxiang 阅读(207) 评论(0) 推荐(0) 编辑