& -- 位运算之一,有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, 就…
半个月没看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了 -------------------------…
链接: https://codeforces.com/contest/1234/problem/D 题意: You are given a string s consisting of lowercase Latin letters and q queries for this string. Recall that the substring s[l;r] of the string s is the string slsl+1-sr. For example, the substrings…
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…
After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3». The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are numbered for…
Problem   Codeforces Round #539 (Div. 2) - C. Sasha and a Bit of Relax Time Limit: 2000 mSec Problem Description Input The first line contains one integer n (2≤n≤3⋅10^5) — the size of the array. The second line contains n integers a1,a2,…,an (0≤ai<2^…
题意: 给出n个数字,要求在这n个数中选出至少两个数字,使得它们的和在l,r之间,并且最大的与最小的差值要不小于x.n<=15 Problem - 550B - Codeforces 二进制 利用二进制, 第i位为1则加上a[i], 为0则不加, #include<iostream> #include <algorithm> #include <cmath> #include<map> using namespace std; typedef long…
还是看大佬的题解吧 CFRound#753(Div.3)A-E(后面的今天明天之内补) - 知乎 (zhihu.com) 传送门  Problem - D - Codeforces 题意 n个数字,n个字符, 数字与字符一一对应, 其中字符R红色代表数字可以上升, B蓝色代表可以下降, 问一顿操作下来能否使n个数含有1~n的所有数 题解 当时真的没想到, 蓝色一定在数组前面, 红色一定在数组后面,( 反正就算有方案使得蓝不在前面, 红不在后面,蓝红也是可以交换的). 排序后, 前面的蓝色数字如果…
http://codeforces.com/contest/426/problem/B 对称标题的意思大概是.应当指出的,当线数为奇数时,答案是线路本身的数 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define maxn 1005 using namespace std; char a[maxn][maxn]; int ans; void solve…
Adieu l'ami. Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence. The space is represented by a rectangular grid of n × m cells, arranged into n…