Codeforces Round #575 (Div. 3) 这个div3打的太差了,心态都崩了. B. Odd Sum Segments B 题我就想了很久,这个题目我是找的奇数的个数,因为奇数想分成x个奇数,那么这个x肯定是一个奇数, 偶数同理,如果一个偶数想分成y个奇数,那么这个y肯定是一个偶数. 所以数奇数的个数,如果奇数有x个,x是偶数,那么k一定是一个偶数,如果x是一个奇数,那么k肯定是一个奇数. 输出也比较简单,因为奇数要分成奇数个,所以可以前面每组都是含有一个奇数,最后肯定会有奇…
A. Three Piles of Candies time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Alice and Bob have received three big piles of candies as a gift. Now they want to divide these candies as fair as poss…
本蒟蒻已经掉到灰名了(菜到落泪),希望这次打完能重回绿名吧...... 这次赛中A了三题 下面是本蒟蒻的题解 A.Three Piles of Candies 这题没啥好说的,相加除2就完事了 #include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll q; scanf("%lld",&q); while(q--) { ll a,b,c; scanf("…
比赛链接:https://codeforc.es/contest/1196 A. Three Piles of Candies 题意:两个人分三堆糖果,两个人先各拿一堆,然后剩下一堆随意分配,使两个人中最后糖果较少的那个人的糖果最多. 分析:水题. AC代码: #include <bits/stdc++.h> #define SIZE 300007 #define rep(i, a, b) for(int i = a; i <= b; ++i) typedef long long ll;…
D2. RGB Substring (hard version) inputstandard input outputstandard output The only difference between easy and hard versions is the size of the input. You are given a string…
E. Connected Component on a Chessboard time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given two integers b and w. You have a chessboard of size 109×109 with the top left cell at (1;1)…
D1. RGB Substring (easy version) time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output The only difference between easy and hard versions is the size of the input. You are given a string s consistin…
C. Robot Breakout time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output n robots have escaped from your laboratory! You have to find them as soon as possible, because these robots are experimental,…
B. Odd Sum Segments time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given an array a consisting of n integers a1,a2,-,an. You want to split it into exactly k non-empty non-intersecting…
传送门 B题题意: 给你n个数,让你把这n个数分成k个段(不能随意调动元素位置).你需要保证这k个段里面所有元素加起来的和是一个奇数.问可不可以这样划分成功.如果可以打印YES,之后打印出来是从哪里开始断开的. 否则打印出NO 题解: 加上奇数可以使和的性质改变,原来使偶数则变为奇数,奇数则变为偶数.加上一个偶数就不会有这样的变化.所以第一步就找出来有多少个奇数.因为要保证k个段的和都为奇数,所以每个段得先有一个奇数 剩下来的奇数数量如果是偶数那就不影响,这样就可以成功划分.如果是奇数那就划分不…