
模拟
文章平均质量分 67
无敌大饺子
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
ZOJ 1239 Hanoi Tower Troubles Again!
直接按题意模拟打表了.貌似不用输出-1. #include #include #include #include using namespace std; const int maxn = 51; int pegs[maxn], tb[maxn],n; bool put(int num){ for (int i = 0; i < n; ++i){ if(pegs[i] == 0){原创 2013-05-07 14:22:25 · 691 阅读 · 0 评论 -
UVA 11549 Calculator Conundrum
很容看出来,一直平方又只取前面n位会构成循环,所以可以模拟,判重的话就用hash #include #include #include using namespace std; const int maxn = 5000; vectorhash1[maxn]; bool vis(int h){ int t = h; h = h % maxn; for(int i = 0; i原创 2013-06-01 17:26:18 · 592 阅读 · 0 评论 -
ZOJ 2656 Travel Around Country(模拟,枚举)
直接枚举每个城市作为起点,然后模拟是否能回到这个起点就可以了. #include using namespace std; const int MAX = 10001; int O[MAX], D[MAX]; int N; int main(int argc, char const *argv[]){ while(scanf("%d", &N) == 1){ for(int i =原创 2014-04-03 20:38:18 · 566 阅读 · 0 评论