Codeforces 931 C. Laboratory Work】的更多相关文章

http://codeforces.com/problemset/problem/931/C 题意: 给定一个数列,要求构造一个等长的数列,使得数列的平均值等于给定数列,并且使得构造出的数列中与原数列相同的数字个数最小,输出最小相同数字个数与构造的数列.数列长度不超过100000,给定数列中最大的数字与最小的数字相差不超过2. 要求构造出的数列中最大值与最小值不能大于或小于原数列中的最大值与最小值. 如果最大-最小=0,那只能使用原数列 如果最大-最小=1,也还是只能使用原数列 如果最大-最小=…
C. Laboratory Work time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : standard output Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value \(n\) tim…
F. Teodor is not a liar! time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Young Teodor enjoys drawing. His favourite hobby is drawing segments with integer borders inside his huge [1;m] segm…
D. Peculiar apple-tree time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained i…
A #include <bits/stdc++.h> #define PI acos(-1.0) #define mem(a,b) memset((a),b,sizeof(a)) #define TS printf("!!!\n") #define pb push_back #define inf 1e9 //std::ios::sync_with_stdio(false); using namespace std; //priority_queue<int,vect…
因为太迟了,所以没去打. 后面打了Virtual Contest,没想到拿了个rank 3,如果E题更快还能再高,也是没什么想法. [A]Friends Meeting 题意: 在数轴上有两个整点\(x_1=a,x_2=b\),要取一个整点\(x_3=c\)使得\(1+2+\cdots+|c-a|+1+2+\cdots+|c-b|\)最小. 题解: 取中点即可. #include<bits/stdc++.h> using namespace std; int a,b; int main(){…
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error. Kirill has already made his measurements, and has got the following integer value…
[题目链接]:http://codeforces.com/contest/821/problem/A [题意] 给你一个n*n的数组; 然后问你,是不是每个位置(x,y); 都能找到一个同一行的元素q和同一列的元素w; 使得q+w=a[x][y] [题解] O(N4)模拟 [Number Of WA] 0 [反思] 不用考虑会选到a[x][y]本身. [完整代码] #include <bits/stdc++.h> using namespace std; #define lson l,m,rt…
*这种题好像不用写题解... 题意: 一个人要改动别人的实验记录,实验记录记录是一个集合 实验记录本身满足:$max(X)-min(X)<=2$ 改动结果要求: 1.新的集合平均值和之前的一样 2.新的集合,$max(Y)<=max(X),min(Y)>=min(X)$ 求新一个和之前相同数值最少的新记录 题解: 首先考虑不同情况, 如果$max-min<=1$ :因为要保证平均值且值域受限制不变,无法改变值(增加一个值之后,要相应的把另外一值减小,而数值只有2/1种,改动没有意义…
题目链接:http://codeforces.com/contest/931/problem/D 题目大意:给你一颗树,每个节点都会长苹果,然后每一秒钟,苹果往下滚一个.两个两个会抵消苹果.问最后在根节点能收到多少个苹果. 解题思路:昨天是我想复杂了,其实就是统计下每层的苹果数,若是奇数则答案+1.因为最终这些苹果都会滚落汇聚到根节点,所以在滚落过程中肯定会碰撞并相消无论苹果是怎么分布的. 代码: #include<iostream> #include<cstdio> #inclu…