模拟
文章平均质量分 69
01的世界
有时,失去了才懂得珍惜
展开
-
例题6-1 并行程序模拟 UVa210 双端队列
concurrency simulatorPrograms executed concurrently on a uniprocessor system appear to be executed at the same time, but in reality the single CPU alternates between the programs, executing so原创 2015-09-15 19:48:23 · 5322 阅读 · 3 评论 -
例题6-5 移动盒子 UVa 12657 链表(模拟链表)
分析:看到这题,就想用list,自己写了好久,其中erase和insert需要注意好多东西,好不容易搞定了,提交总是超时。大概list的遍历会很慢吧。书上用的是数组形式双向链表,学习了一下,AC了。#include #include #include #include #include #include #include#include#define LL long原创 2015-09-16 16:28:51 · 458 阅读 · 0 评论 -
例题6-4 破损的键盘 UVa 11988
题意:字符'['表示句首,就是光标移到了句首,’】‘表示句尾分析:这题看到有人用双端队列,把[加入队首,】加入队尾,再按照队列中的顺序输出#include #include #include #include #include using namespace std;char str[100010];int main(){ // freopen("f.txt","r",原创 2015-09-16 08:58:26 · 732 阅读 · 0 评论 -
BestCoder Round #52 (div.2) 1001题
Victor and MachineAccepts: 452Submissions: 1123Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Problem DescriptionVictor has a machine. When t原创 2015-08-23 07:58:38 · 306 阅读 · 0 评论 -
zoj 3627 贪心模拟
题目:点击打开链接题意:有n个城市排列在一条线上,两个人刚开始处在p位置,每到一个城市可以获得这个城市的财宝,但是需要一天。他们一共有t天时间可以行动,但是他们之间的距离不能超过m,求最大获得财富。分析:若想获得最大财富,那么这两个人刚开始必须分头走,一直走到相距m,如果还有时间的话,那就要同时往左,或者同时往右走,一直走到头,如果还有时间的话,那么再返回,看看是否还能走到另一边获原创 2016-02-18 10:13:47 · 342 阅读 · 0 评论 -
HOJ 1017 模拟约瑟夫问题
题目:http://acm.hit.edu.cn/hoj/problem/view?id=1017题意:前K个是好人,后K个是坏人,要求在杀掉第一个好人之前,已经杀掉所有坏人分析:模拟一下约瑟夫问题的过程,枚举m,看看是否前K次会杀掉好人,如果会,那么m就不行。#includeint f[15];bool solve(int k,int m){ int s原创 2016-03-13 09:12:13 · 384 阅读 · 0 评论