codeforces
P1n9
这个作者很懒,什么都没留下…
展开
-
codeforces贪心 B. Students in Railway Carriage
B. Students in Railway Carriage time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output There are n consecutive seat places in a railway carr...原创 2018-04-12 20:20:59 · 285 阅读 · 0 评论 -
Codeforces Round #555 (Div. 3) E. Minimum Array
地址:https://codeforces.com/contest/1157/problem/E题意:给了两个数组a和b,范围都是0~(n - 1),对每个a数组的值,到b数组找一值进行(a[i] + b[j]) % n,形成数组c,最后要数组c最小,输出c数组解法:一看就是贪心,a数组顺序遍历,到b数组找一个未用过的数,与当前数计算后得到的值最小,因为a[i]与n - a[i]形成的值是0...原创 2019-04-29 11:03:22 · 130 阅读 · 0 评论 -
Codeforces Round #538 (Div. 2) C. Trailing Loves (or L'oeufs?)
地址:http://codeforces.com/contest/1114/problem/C刚开始想错了,每次一有思路就着急敲代码,每次敲完之后输样例发现走不通了,应该对应每个样例之后都解释的通,心中敲定做法之后,然后再敲;思路:对b分解质因数之后,记录其质因数及其个数a;然后再求其1~n中对应质因数的个数b(利用筛素数的原理,先找出公因子为一个b的个数(n / b),再求公因子为两个b...原创 2019-02-11 10:44:38 · 229 阅读 · 0 评论 -
Codeforces Global Round 1 B和C题
地址:http://codeforces.com/contest/1110过了点时间做这些题,脑子都慢了,三四千人过的题,我都不怎么会B题解析:给定一个数列b,在数列b上分割成k(k <= K)部分,k部分的长度(每一段右端点 - 左端点 - 1)的加和最小。刚开始一直怎么贪心取区间长度小的,但是反过来想一想,找区间长度可能不现实,因为最大也就是b[n] - b[1] + 1,就找间隔...原创 2019-02-09 10:33:19 · 97 阅读 · 0 评论 -
Educational Codeforces Round 52 (Rated for Div. 2) C. Make It Equal
题目:https://codeforces.com/contest/1065/problem/C这道题是服了,我的算法是贪心模拟,贪心的找切片,写的比较慢,因为是模拟,所以考虑的比较多,而且变量比较多。。。。。。赛后居然被hack了。。。好气,为什么呢,就是少考虑了初始时高度都一样,每次都是不考虑特殊情况。。。希望自己能够吃个教训。。。还有我觉得自己脑子里都是暴力,模拟,看了大佬的代码,人家...原创 2018-10-12 10:31:41 · 117 阅读 · 0 评论 -
codeforces Round #501 (Div. 3) D. Walking Between Houses
题目地址:http://codeforces.com/contest/1015/problem/D理解很简单,主要有一段代码写起来没考虑好#include<bits/stdc++.h>using namespace std;typedef long long LL;const int inf = 0x3f3f3f3f;const int N = 200005;int ...原创 2018-08-02 19:14:34 · 138 阅读 · 0 评论 -
Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms
题目:http://codeforces.com/contest/1016/problem/C 转载:https://blog.csdn.net/qq_40160605/article/details/81432788 #include<bits/stdc++.h>using namespace std;typedef long long LL;const int i...转载 2018-08-07 11:46:02 · 137 阅读 · 0 评论 -
codeforce#500 C. Photo of The Sky
地址:http://codeforces.com/contest/1013/problem/C 思维总是不能全面的想,只想到了找矩形的左下和右上点,但也可以找左上和右下的点,这点就没想到,本来是个简单题。。。。#include<bits/stdc++.h>using namespace std;typedef long long LL;const int inf = 0...原创 2018-07-30 23:01:15 · 172 阅读 · 0 评论 -
C. Equal Sums(codeforces)
地址:http://codeforces.com/contest/988/problem/C 类似于一些后一个与前一个产生关系的题目的做法#include<bits/stdc++.h>using namespace std;typedef long long LL;const int N = 200005;int a[N];int main(){ map&...原创 2018-06-06 17:11:30 · 209 阅读 · 0 评论 -
codeforces D. Merge Equals
看了题解,做法很强,一直纠结在一定要先弄最小的前两个数合并,第一感觉是优先队列,但我写的超时,无语了,这个做法真的很强#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>#include<map&g...原创 2018-04-12 23:22:04 · 176 阅读 · 0 评论 -
coeforce---Submarine in the Rybinsk Sea
地址:easy:https://codeforces.com/contest/1195/problem/D因为每个数的长度相同,所以每个数的每个位对答案的贡献是在答案的2k位,2k-1位#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using ...原创 2019-07-21 17:21:12 · 204 阅读 · 0 评论