随笔分类 -  模拟

摘要:Overlapping Squares我的思路:可以根据所给图形计算出图形中包含的方块的个数以及它们各自的位置,方块可以根据某一个角点的位置来确定,具体方法见 count() 函数。方块确定之后,图形的各种变化就取决于方块们的不同放置顺序了,枚举所有排列,进行模拟,看... 阅读全文
posted @ 2018-12-29 15:49 ACLJW 阅读(213) 评论(0) 推荐(0)
摘要:1073D. Berland Fair每次先走一圈,计算出可以购买的糖果的总价格 c 和总个数 t,然后 cnt += t*(T/c) T %= c,循环至无糖果可买。时间复杂度计算如下:#includeusing namespace std;const int m... 阅读全文
posted @ 2018-10-31 23:54 ACLJW 阅读(162) 评论(0) 推荐(0)
摘要:S-Trees#includeusing namespace std;const int maxn = 7;int n,m,t,cnt = 0;char s[2];int a[maxn];char b[maxn];char leaf[int(pow(2,maxn))]... 阅读全文
posted @ 2018-08-09 22:11 ACLJW 阅读(94) 评论(0) 推荐(0)
摘要:Dropping Balls直接模拟似乎很简单,但是会超时。。。每个小球都会落在根结点上,因此前两个小球必然是一个在左子树,一个在右子树。一般地,只需看小球编号的奇偶性,就能知道它是最终在哪棵子树中。对于那些落入根结点左子树的小球来说,只需知道该小球是第几个落在根的左... 阅读全文
posted @ 2018-05-28 18:34 ACLJW 阅读(139) 评论(0) 推荐(0)
摘要:Queue and A#includeusing namespace std;const int maxn = 1000 + 5;struct topic{ int n,st,t,b,w = 0;}t;struct person{ int w = 0,st... 阅读全文
posted @ 2018-04-30 23:50 ACLJW 阅读(165) 评论(0) 推荐(0)
摘要:Printer Queuepriority_queue + queue#include#includeusing namespace std;const int maxn = 500000;int t,n,pos;int main(){ scanf("%d",&... 阅读全文
posted @ 2018-04-22 16:52 ACLJW 阅读(179) 评论(0) 推荐(0)
摘要:Ducci Sequenceversion 1(130ms):#includeusing namespace std;const int maxn = 20;int t,n,a[maxn];int main(){ scanf("%d",&t); while... 阅读全文
posted @ 2018-04-21 22:05 ACLJW 阅读(164) 评论(0) 推荐(0)
摘要:The Letter Carrier's Rounds注意可能有重复的收件人。version 1(20ms):#include#include#include#include#include#includeusing namespace std;const int m... 阅读全文
posted @ 2018-04-20 17:10 ACLJW 阅读(112) 评论(0) 推荐(0)
摘要:PGA Tour Prize Money 这道题太麻烦了,先放这儿,日后再说。。。#include#include#includeusing namespace std;const int maxn = 150;struct player{ char name[... 阅读全文
posted @ 2018-04-19 19:18 ACLJW 阅读(228) 评论(0) 推荐(0)
摘要:Team Queue本题有两个队列:每个团队有一个队列,而团队整体又形成一个队列,建两个queue即可。#include#include#includeusing namespace std;const int maxt = 1000 + 5;int t,n;char... 阅读全文
posted @ 2018-04-16 23:58 ACLJW 阅读(152) 评论(0) 推荐(0)
摘要:The SetStack Computer为每个不同的集合分配一个唯一的ID,则每个集合都可以表示成所包含元素的ID集合,这样就可以用STL的set来表示了,而整个栈则是一个stack。#include#include#include#include#include#... 阅读全文
posted @ 2018-04-16 21:46 ACLJW 阅读(176) 评论(0) 推荐(0)
摘要:The Blocks Problem其实四条命令可以简化为两个操作:1. 把某个块上面的块放回原位;2. 把某个块及其上的块放到另一个块所在的堆顶。还可以加一个数组保存每个块的所在的堆,这样写出来的代码比书上还间接哈哈哈。第一次WA是多输出了换行,第二次是以为有多组数... 阅读全文
posted @ 2018-04-15 17:11 ACLJW 阅读(129) 评论(0) 推荐(0)
摘要:Othello我的这道题的代码还是比较简洁的哈哈。version 1:#include#includeusing namespace std;int n,wn,bn;int dxs[3] = {0,1,-1};int dys[3] = {0,1,-1};char c,... 阅读全文
posted @ 2018-04-13 13:30 ACLJW 阅读(191) 评论(0) 推荐(0)
摘要:UVa - 512 Spreadsheet Tracking思路1:首先模拟操作,算出最后的电子表格,然后在每次查询时直接在电子表格中找到所求的单元格。#include#includeusing namespace std;const int maxn = 100,b... 阅读全文
posted @ 2018-04-11 20:42 ACLJW 阅读(197) 评论(0) 推荐(0)
摘要:The Dole Queue Time limit: 3.000 secondsIn a serious attempt to downsize (reduce) the dole queue, The New National Green Labour Rhinoc... 阅读全文
posted @ 2018-04-10 13:10 ACLJW 阅读(121) 评论(0) 推荐(0)
摘要:489 - Hangman JudgeTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show... 阅读全文
posted @ 2018-04-09 17:32 ACLJW 阅读(139) 评论(0) 推荐(0)