B. Two Cakes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them in…
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define IT set<ll>::iterator #define sqr(…
[题目链接]: Educational Codeforces Round 35 (Rated for Div. 2) A. Nearest Minimums time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array of n integer numbers a0, a1, ..., an -…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 从小到大枚举x. 看看a/x+b/x是不是大于等于n 是的话. 看看是不是两种蛋糕都能凑一堆. 也即x的最大枚举量是min(a,b) 不然可能有多余的a%x没地方放.(因为它都还没有一堆 [代码] #include <bits/stdc++.h> using namespace std; int n,a,b; int main(){ #ifdef LOCAL_DEFINE freopen("rush_in.txt&q…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 直觉题. 感觉情况会很少. 毕竟间隔太大了.中间肯定有一些数字达不到. 有1肯定可以 2 2 x肯定可以 3 3 3也可以 2 4 4也可以. 就这样 [代码] #include <bits/stdc++.h> using namespace std; vector <int> v; int main(){ #ifdef LOCAL_DEFINE freopen("rush_in.txt", &…
B. Two Cakes 传送门:http://codeforces.com/contest/911/problem/B 本题是一个数学问题. 有a个Ⅰ类球,b个Ⅱ类球:有n个盒子.将球放入盒子中,要求: ①所有的球均被放入盒子中: ②每一个盒子中至少有一个球: ③一个盒子里至多只能有一类球. 设将所有的球放入盒子后,每个盒子里至少有x个球.求x的最大值. 由上述规则可知,一个盒子或放入Ⅰ类球,或放入Ⅱ类球.设放入Ⅰ类球的盒子数为i,放入Ⅱ类球的盒子数为j,则:i+j=n. 于是,为使盒子中放入…
A. Nearest Minimums time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimum…
Nearest Minimums 相同的数里最小的数里的最小距离 Solution Two Cakes Solution Three Garlands 瞎比试 Solution Inversion Counting 先算出来最初逆序对个数,对于每次选择,如果选出的区间里数对个数为偶数个,则其中正序对和逆序对个数可能分别为(奇数+奇数)或(偶数+偶数),此时总的逆序对奇偶性不变:如果选出的区间里数对个数为奇数个,则其中正序对和逆序对个数可能分别为(奇数+偶数)或(偶数+奇数),此时总的逆序对奇偶性…
C. Three Garlands time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mi…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 排列中交换任意两个数字. 排列的逆序对个数的奇偶性会发生变化. 翻转这个过程其实就是len/2对数字发生交换. 交换了偶数次的话,不变,否则奇偶性发生改变. 先暴力求出一开始的逆序对个数就好 [代码] #include <bits/stdc++.h> using namespace std; const int N = 1500; int n,a[N+10],cnt,now,m; void out(int x){ if (x=…