
模拟
sega_handsome
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #451 (Div. 2) B. Proper Nutrition
B. Proper Nutrition time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outputVasya has n burles. One bottle of Ber-Cola costs a burles and one转载 2017-12-16 21:41:04 · 313 阅读 · 0 评论 -
Gym - 101608G (尺取)
https://vjudge.net/contest/208695#problem/G Just days before the JCPC, your internet service went down. You decided to continue your training at the ACM club at your university. Sadly, you discov...原创 2018-04-25 13:46:34 · 380 阅读 · 0 评论 -
Educational Codeforces Round 34 (Rated for Div. 2) D - Almost Difference
参考:http://blog.youkuaiyun.com/kamiyoru/article/details/78791923当读入第k个数字的时候: ans′=∑k−1i=1(numberk−nubmeri)=(k−1)numberk−∑k−1i=1nubmeri 当然这不是实际的答案,因为差值为1及以内的数是不必加到答案上的; 所以 ans=ans′−countnumberk−1+countnumb转载 2017-12-16 19:26:02 · 250 阅读 · 0 评论 -
Codeforces Round #449 (Div. 1) A. Nephren gives a riddle 模拟.
A. Nephren gives a riddle time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output What are you doing at the end of the world? Are you busy转载 2017-12-03 09:06:38 · 250 阅读 · 0 评论 -
Ice-cream Tycoon SGU - 311 splay
splay参考:http://blog.youkuaiyun.com/acm_fighting/article/details/52331833Splay中有一些常用的操作和一些很容易犯的bug先来记录一下容易写错的地方 新建结点(或者连续一段,特指在key_value的位置插入和删除)或者删除结点(或者连续一段)的时候需要pushup(ch[root][1]),pushup(root) 申请一个转载 2017-10-28 10:23:07 · 235 阅读 · 0 评论 -
cf 758 B. Blown Garland模拟
自己没有想出,打算用挺麻烦的方法。。就不写了。 看别人的好好啊。。 转自http://blog.youkuaiyun.com/wang907553141/article/details/54636868 #include #include #include #define LL long long using namespace std; LL n,m,转载 2017-03-19 16:28:49 · 285 阅读 · 0 评论 -
798B - Mike and strings 各种方式。
自己当时打算用bfs,,结果MLE了。。 想想简直太傻了。。 没有利用好条件,,条件说只会把最前面的放到最后面去。。 这个时候就应该想到之前看过的,,把两个字符串合并在一起啊。。(这个不是就是KMP的吗。。)(看来是思维没有掌握。。) 分析:肯定是把所有串变成其中一个原本就有的串是最优的。。。(我无法证明。。我是弄了一个各种可能。。) 我的代码奇丑务必,放在最后。。转载 2017-04-22 10:36:24 · 542 阅读 · 0 评论 -
17浙江省赛 数位dp or xjb乱搞
转自:http://www.cnblogs.com/wuwangchuxin0924/p/6749799.html 居然可以用数位dp ,看来自己还是没有学好啊。。。但是用苏大佬的做法做的还是wa了,,不知道还有哪里没有考虑周全,,不过那种思想还是挺好的。。 // 大概对于数位dp 的进一步思考: 就是有挺多是重复计算的,如果位数相同的话,这个时候只要是sum相同的,那么之后的结转载 2017-04-23 20:29:04 · 312 阅读 · 0 评论 -
Harmonic Value Description HDU - 5916 构造
https://vjudge.net/contest/179746#problem/F这题还以为自己做不出。然后多想了之后发现不难。。 代码不太好懂,反正自己构造。。int a[N]; int vis[N]; int main(){ int T;sf("%d",&T); int cas=0; while(T--){ mem(vis,0);mem(a,0);原创 2017-08-16 21:39:44 · 176 阅读 · 0 评论 -
Ugly Problem HDU - 5920 模拟+贪心。。
https://vjudge.net/contest/179746#problem/J题意:给定一个数字,找出一个或几个回文数字,使得这几个回文数字之和刚好等于给出的数字。回文数字的数量不大于50!!!自己不会,,只能模仿别人的。。https://vjudge.net/solution/9774667 while(T--){ sf("%s",s+1); int len=strl原创 2017-08-17 09:34:10 · 238 阅读 · 0 评论 -
Codeforces 527C Glass Carving (set+multiset)
对于一个矩形,宽为w,高为h。现在对其进行一系列的切割。让你求出每次切割后的最大面积的矩形参考http://blog.youkuaiyun.com/u011580493/article/details/44457477 学习了下multiset。。 没想到STL那么好用 LL w,h,n; set<LL>st[2]; multiset<LL>mst[2]; LL solve(int sta,int val)转载 2017-08-21 12:50:00 · 202 阅读 · 0 评论 -
Cookie Choice II ZOJ - 3297 头尾指针维护
这题还有别的写法;这只是别人的一种 注意这个判断合不合法不要又重复判断。。。 一开始逗比了,还打算重复判断那样坑定会超时。。 用个头尾指针更清晰 这里的p就是头指针,i是尾指针。。int a[N],L[N],R[N]; int cnt[N]; void solve(){ int p=1; int ans=-1; for(int i=1;i<=n;++i){转载 2017-08-26 22:33:31 · 235 阅读 · 0 评论 -
codeforces 675D Tree Construction(set)
转自http://blog.youkuaiyun.com/qq_21057881/article/details/51439406 //题意: 给你n个节点,第一个节点作为根节点,接下来的如果节点值>他的父节点,就将他练到他的右边,否则练到左边,输出从2–n节点的父节点的编号。 #include<iostream> #include<cstdio> #include<map>转载 2017-08-27 22:58:54 · 189 阅读 · 0 评论 -
【Codeforces Round 354 (Div 2)B】【简单模拟】Pyramid of Glasses
转载自http://blog.youkuaiyun.com/snowy_smile/article/details/51514566**【题意】 漏斗漏水n层t秒灌满多少个,具体如图 n∈[1,10] t∈[0,1e4] **分析:一开始以为是数学题推规律。。结果找错了。。 看了题解,直接模拟就好了。。还可以用一些方式处理精度问题。。int a[N][N]; int main(){ int转载 2017-08-28 09:38:26 · 244 阅读 · 0 评论 -
Numbers HDU - 6168 stl
https://vjudge.net/problem/HDU-6168 题意: 如果我们现在有一个数组A【1····n】,那么我们每一次拿出两个数A【i】和A【j】(1≤iint ans[N]; int a[N]; int vis[N]; map<int,int>mp; int main(){ int n; while(~sf("%d",&n)){ mem(vis转载 2017-08-23 21:22:43 · 216 阅读 · 0 评论 -
Codeforces Round #388 (Div. 2)D. Leaving Auction
题目链接:http://codeforces.com/contest/749/problem/D Codeforces Round #388 (Div. 2) DThere are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it转载 2017-09-29 22:16:40 · 189 阅读 · 0 评论 -
Codeforces Round #441 (Div.2) - D - Sorting the Coins xjb搞搞。
题意:有n个硬币,刚开始所有的硬币均为不流通,然后分开n次使得n个硬币流通,小明每次只能从左到右看,不能返回,且不能用手改变位置,若看的位置是流通硬币且下一个硬币是不流通的,则小明则在心中将这两个硬币交换位置,若前后两个硬币均为流通或不流通则不交换,问每次将此时流通的硬币全部排到最后的难度是多少(因为每次看完要记住当前的位置,所以看的次数越多越难,不用看时的难度为1多看一次加一)。思路:已经在最后的原创 2017-10-20 17:18:17 · 189 阅读 · 0 评论