地址:http://codeforces.com/contest/801/problem/C 题目: C. Voltage Keepsake time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have n devices that you want to use simultaneously. The i-th devi…
A. Vicious Keyboard time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Tonio has a keyboard with only two letters, "V" and "K". One day, he has typed out a string s with only t…
地址:http://codeforces.com/contest/801/problem/D 题目: D. Volatile Kite time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a convex polygon P with n distinct vertices p1, p2, ..., p…
A. Vicious Keyboard 题意:给你一个字符串,里面只会包含VK,这两种字符,然后你可以改变一个字符,你要求VK这个字串出现的次数最多. 题解:数据范围很小,暴力枚举改变哪个字符,然后check就好. #include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int ans = 0; for(int i=0;i<s.size();i++){ if(s[i]=='V'){…
A 每次可以换一个或不换,暴力枚举位置即可 B 模拟 C 二分答案.. 边界可以优化r=totb/(tota-p),二分可以直接(r-l>=EPS,EPS不要太小,合适就好),也可以直接限定二分的次数(防止死循环! 一开始EPS=1e-10,结果TLE) 注意精度问题 long double,在统计和的时候注意long long…
A. Vicious Keyboard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Tonio has a keyboard with only two letters, "V" and "K". One day, he has typed out a string s with only t…
Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) 全场题解 菜鸡只会A+B+C,呈上题解: A. Bear and Big Brother 题意:我也没看太清,就是给你两个10以内的数a,b.a每天乘以3,b每天乘以2,求多少天后a大于b. 思路:应该是有公式的,不过看到数据这么小直接暴力乘求解.官方题解貌似就是这样,数据小就是水题. const int N=1e3+10; int main() { int a…
C. Bear and Different Names 题目连接: http://codeforces.com/contest/791/problem/C Description In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should s…
B. Bear and Friendship Condition 题目连接: http://codeforces.com/contest/791/problem/B Description Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pic…
我们要统计的答案是sigma([L/K]),L为路径的长度,中括号表示上取整. [L/K]化简一下就是(L+f(L,K))/K,f(L,K)表示长度为L的路径要想达到K的整数倍,还要加上多少. 于是,我们现在只需要统计sigma((L+f(L,K))),最后除以K即可. 统计sigma(L)时,我们考虑计算每条边出现在了几条路径中,设u为edgei的子节点,那么这条边对答案的贡献就是siz(u)*(n-siz(u)),siz(u)为u的子树大小. 统计sigma(f(L,K))时,我们需要dp出…