摘要: 题目链接居然没更新flag就交了,错了两次。。3个题,都是一个类型。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <algorithm> 6 #include <vector> 7 using namespace std; 8 int o[5001]; 9 int flag[5001];10 int find(int x)11 {12 if(x == o[x]) return x; 阅读全文
posted @ 2013-06-17 19:21 Naix_x 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 题目链接经过宝哥的讲解,终于对这种问题有了进一步的理解。根据flag[x]和flag[y]求flag[tx]是最关键的了。0吃1,1吃2,2吃0.假设flag[tx] = X;那么X + flag[x] = flag[y] + 2 (当x吃y的时候) 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <algorithm> 6 #include <vector> 7 using name 阅读全文
posted @ 2013-06-17 17:01 Naix_x 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 题目链接这种类型的题目以前见过,今天第一次写,具体过程,还要慢慢理解。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <algorithm> 6 #include <vector> 7 using namespace std; 8 int o[100001]; 9 int flag[100001];10 int find(int x)11 {12 if (x == o[x]) ret 阅读全文
posted @ 2013-06-17 14:33 Naix_x 阅读(166) 评论(0) 推荐(0) 编辑