typedef unsigned long long u64; typedef __int128 i128; typedef pair <int,int> pi; typedef vector <int> VI; typedef array <int,3> tri; const int N=2e6+5; class FileInputOutput { private: static const int S=1<<21; #define tc() (A==B&&(B=(A=Fin)+fread(Fin,1,S,stdin),A...
Codeforces Round #636 (Div. 3) 题目链接 A. Candies 题意:给定一个n,求让 x+2*x+4*x+⋯+2^k−1*x = n 等式成立的任意一个x。 题解:x = n / (1 + 2 + 4 + ⋯ + 2^k-1) 当n % (1 + 2 + 4 + ⋯ + 2^k-1) = 0 时即可。 B. Balanced Array 题意:给定一个...
Codeforces Round #636 B. Balanced Array(水) You are given a positive integer nn , it is guaranteed that nn is even (i.e. divisible by 22 ). You want to construct the array aa of length nn such that: The first n2n2 elements of aa are even (divisible by 22 ); the second n2n...
题目:Codeforces 1343B - Balanced Array https://codeforces.com/problemset/problem/1343/B 翻译 给一个数字 n,保证数字 n 是偶数。 需要构造一个长度为 n 的数列 a,并有如下要求: 前n/2 个元素要求是偶数 后n/2 个 元素要求是奇数 a 内的所有元素要求不同并且是正数 前半部分元素的和等于后半部分的...
Let pp be the prefix sum array of a bracket sequence (we assign 11 to (( and −1−1 to )) and take the prefix sum). For example, if our bracket sequence is ())()((())())()((()), then p=[1,0,−1,0,−1,0,1,2,1,0]p=[1,0,−1,0,−1,0,1,2,1,0...
Balanced Array http://codeforces.com/contest/1343/problem/B 分别构造偶数和奇数序列,最后一个位置用来补充不足的数 1 // 2 // Created by w on 2021/1/8. 3 // 4 5 #include <iostream> 6 using namespace std; 7 int main() 8 { 9 int t; 10 cin>>t; 11 while (t--) 12 { 13 ...
Codeforces1343B Balanced Array(思维,奇数偶数) B. Balanced Array time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a positive integernn, it is guaranteed thatnn is even (i.e. divisible by22)....