A. Raising Bacteria time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are a lover of bacteria. You want to raise some bacteria in a box. Initially, the box is empty. Each morning, you can…
半个月没看cf 手生了很多(手动大哭) Problem - A - Codeforces 题意 给定数字n, 求出最大数字k, 使得  n & (n−1) & (n−2) & (n−3) & ... (k) = 0 题解 &:有0则0 假如n转为二进制共有x位 , 要使&后=0, k的最高位需=0 我们使最高位=0,后面都为1; 那么此数+1=什么 =100000(x-1个0), 这样就能&后=0了 -------------------------…
& -- 位运算之一,有0则0 原题链接 Problem - 1514B - Codeforces 题目 Example input 2 2 2 100000 20 output 4 226732710 题意 t个测试样例,在每个样例中 数组有n个数,数字范围[ 0, 2k - 1] 使得数组每个数&后,结果=0,并且这n个数的和要尽量大 输出有多少个这样的数组 解析 数组每个数&后,结果=0  -->每一位至少一个0 数要尽量大  -->只要这一位可以 != 0, 就…
C. Weakness and Poorness Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/578/problem/C Description You are given a sequence of n integers a1, a2, ..., an. Determine a real number x such that the weakness of the sequence a1 -…
B. "Or" Game Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/578/problem/B Description You are given n numbers a1, a2, ..., an. You can perform at most k operations. For each operation you can multiply one of the number…
题目链接:http://codeforces.com/contest/578/problem/B 题目大意:现在有n个数,你可以对其进行k此操作,每次操作可以选择其中的任意一个数对其进行乘以x的操作.思路:最先想到的办法是贪心,也就是选择数组中最大的那个数对它进行k次乘以x的操作.但是这种方法在有的时候会出现错误,如测试数据的第三组:2 1 212 9这种情况下有2个数,我能够对其进行1次乘以2的操作,如果以之前贪心的方法,选择12乘以2,那么得到的结果(12*2)|9=25,但是如果选择9乘以…
E. Weakness and Poorness time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a sequence of n integers a1, a2, ..., an. Determine a real number x such that the weakness of the seq…
D. "Or" Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given n numbers a1, a2, ..., an. You can perform at most k operations. For each operation you can multiply one of…
E. Weakness and Poorness time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a sequence of n integers a1, a2, ..., an. Determine a real number x such that the weakness of the seq…
显然f(x)是个凹函数,三分即可,计算方案的时候dp一下.eps取大了会挂精度,指定循环次数才是正解. #include<bits/stdc++.h> using namespace std; ; ; double a[maxn]; double d1[maxn],d2[maxn]; int n; inline double cal(double x) { ., a2 = .; ; i <= n; i++){ d1[i] = max(.,d1[i-])+a[i]-x; a1 = max(…