Good Bye 2018 (A~F, H)】的更多相关文章

目录 Codeforces 1091 A.New Year and the Christmas Ornament B.New Year and the Treasure Geolocation C.New Year and the Sphere Transmission(思路) D.New Year and the Permutation Concatenation(思路 计数) E.New Year and the Acquaintance Estimation(Erdos–Gallai定理…
咕bye 2018,因为我这场又咕咕咕了 无谓地感慨一句:时间过得真快啊(有毒 A.New Year and the Christmas Ornament 分类讨论后等差数列求和 又在凑字数了 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int a,b,c; int main() { scanf("%d%d%d",&a,&b,&…
Good Bye 2018! 题目链接:https://codeforces.com/contest/1091 A. New Year and the Christmas Ornament 题意: 给出三堆数量分别为y,b,r的东西,现在要你从三堆中各选一堆,满足y'+1=b'且b'+1=r' (y',r',b'分别是指从中选取的个数). 现在问最多能拿出的个数为多少. 题解: 我是直接模拟的= =但是有更简单的方法. 让y+=2,b+=1,那么现在的最优解为min(y,b,r)*3-3.这个还…
题目链接  ZOJ Monthly, March 2018 Problem F 题意很明确 这个模数很奇妙,在$[0, mod)$的所有数满足任意一个数立方$48$次对$mod$取模之后会回到本身. 所以开$48$棵线段树,和一个永久标记.当对某个区间操作时对这个区间加一层永久标记. 即当前我要查找的第$x$层,实际找的是第$up[i] + x$层. 时间复杂度$O(48nlogn)$ #include <bits/stdc++.h> using namespace std; #define…
Good Bye 2018题解 题解 CF1091A [New Year and the Christmas Ornament] 打完cf都忘记写题解了qwq 题意就是:给你一些黄,蓝,红的球,满足蓝的数量恰比黄的多一,红的数量恰比蓝的多一 容易发现黄的数量恰是\(\min{y,b-1,r-2}\) 输出这个值\(*3+3\)即可 # include <bits/stdc++.h> int main() { int y, b, r; scanf("%d%d%d", &…
Good Bye 2018 2018年最后一场CF,OVER! 弱弱的我只能做出3道A,B,D~~~~ 最后几分钟,感觉找到了C题的规律,结束的那一刻,提交了一发 "Wrong answer on pretest 5"......... 一开始,做完AB题直接就看C题,当时没想着打表找规律,死抠了好大一会,没思路,果断换题; D题打了个表,找到了规律,AC~~~ 然后,回过头来接着看C,无奈之举,打了个表,由于当时时间紧迫,找了二十多分钟的规律,只找了看了前十个数,发现他们有一个共同的…
传送门 https://www.cnblogs.com/violet-acmer/p/10201535.html 题意: n 个people,编号1~n,按顺时针方向围城一圈: 初始,编号为1的people抱着一个球,他可以将球顺时针传给第 k 个people; 接到球的people将球传给他顺时针方向的第 k 个people,循环进行,直到球再一次落到 1 号 people 手中结束: 定义一个开心值 :所有接到球的 people 的编号和. 求所有的开心值,并按升序排列. 题解: 弱弱的我只…
目录: B - Fraction D - Triangle F - Harmonic Value Description H - Sequence I I - Sequence II B题:HDU 5912 - Fraction - [递归] 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5912 Problem DescriptionMr. Frog recently studied how to add two fractions up, an…
A. New Year and the Christmas Ornament 签到. #include <bits/stdc++.h> using namespace std; int a, b, c; int main() { while (scanf("%d%d%d", &a, &b, &c) != EOF) { , c - )); printf( + ); } ; } B. New Year and the Treasure Geolocati…
E Find the median 题意:每次往序列中增加连续的[l,r]的数,每加入一次就询问当前序列的中位数. 解法:此题没有要求在线,那么直接离线+线段树+二分就可以了.求出每个端点之后排序得到数组b,线段树每个叶子结点i存储的是区间[ b[i-1]+1,b[i] ]的系数(即当前序列有多少个[ b[i-1]+1,b[i] ]).修改时顺便维护当前总的数个数sum,然后处理询问就是直接在线段树上二分就可以了. #include<bits/stdc++.h> #define lc o*2…