首页 > TAG信息列表 > 626

CF Round#626 D - Present

D - Present 位运算 + 思维 + 二分(双指针) 按位考虑,第 \(k\) 位是 0 还是 1 只跟前 \(k\) 位有关,因此算第 \(k\) 位的答案时可对 \(a\) 数组的元素 \(\mod 2^{k+1}\) 赋给 \(b\) 若 \(b_i+b_j\) 第 \(k\) 位是 \(1\), 则 \(a_i+a_j\) 的值域为 \([2^k,2^k-1],\;[2^k+2^{k+1},2^{k+

leetcode 626前K个高频单词

问题描述 给一非空的单词列表,返回前 k 个出现次数最多的单词。 返回的答案应该按单词出现频率由高到低排序。如果不同的单词有相同出现频率,按字母顺序排序。 https://leetcode-cn.com/problems/top-k-frequent-words/ 示例: 输入: [“i”, “love”, “leetcode”, “i”, “l

[Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics)] B

//很好玩的一道题#include <bits/stdc++.h> #define P pair<int, int> #define ll long long using namespace std; const int maxn = 4e4 + 5; int n, m, k; ll ans; int a[maxn], b[maxn]; int main() { int c[5] = { 0, 1, 2, 3 }; int ccc = lower_bou

Codeforces Round #626 部分题解

A,B 咕了 C - Instant Noodles 不会做C,身败名裂…… 考虑右边的点,如果一些点连的左边的集合相同,那么可以把他们缩在一起。然后我们再把空集删掉。 此时就有答案是所有点的\(\gcd\)。 证明:反证法。先全部除掉一个\(\gcd\)。设\(g\)为可以乘到答案上的一个数。如果\(sum\)不是\(g\)

[Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics)] -D. Present(异或性质,按位拆

[Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics)] -D. Present(异或性质,按位拆分,树桩数组) D. Present time limit per test 3 seconds memory limit per test 512 megabytes input standard input output standard output Catherine received an a

codeforce #626 div2

# A.Even Subset Sum Problem # 题意 数组 

Codeforces Round #626 (Div. 1, based on Moscow Open Olympiad in Informatics) A-D

https://codeforces.com/contest/1323   A. Even Subset Sum Problem. 数据范围只有100,两个for暴力枚举一遍,记录满足题意的区间左右端点即可。最后输出。 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int maxn = 105; 5 ll a[maxn

Div 626 D

题目链接 题意:给n个数n 4e5 求     这道题在做的时候一点思路都没有,感觉无从下手想过计算最后每一位是什么,从而计算结果但是还是感觉无从下手。 看了看题解,感觉豁然开朗 当我们要计算最后的结果中第k位是0还是1时,它与每个数的[k+1, )是没有关系的,所以当我们求每一位是,对所有的

Codeforces Round #626(Count Subrectangles)

题目: You are given an array a of length n and array b of length m both consisting of only integers 0 and 1. Consider a matrix c of size n×m formed by following rule: ci,j=ai⋅bj (i.e. ai multiplied by bj). It’s easy to see that c consists of only zero

Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics)

A. Even Subset Sum Problem 题意 给出一串数,找到其中的一些数使得他们的和为偶数 题解 水题,找到一个偶数或者两个奇数就好了 代码 #include<iostream> #include<cstdio> #include<cstring> #define def 110 using namespace std; long a[def]; int main() { long _,ans0,an

Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics)

Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics) 比赛链接 A. Even Subset Sum Problem 找出第一次出现的一个偶数或者两个奇数 #include<bits/stdc++.h> #define IOS ios::sync_with_stdio(0);cin.tie(0); #define MEM(X,Y) memset(X,Y,siz

Sgg:(LeetCode每日一题)--626_换座位

换座位1 题目概述2 思路变迁2.1 简单case函数2.2 case when 搜索函数3 代码开搂 1 题目概述 难度:中等 2 思路变迁 主要说明一下case when的用法吧: 2.1 简单case函数 case sex when sex = 1 then '男' when sex = 1 then '女' else '其他' end 2.2 case when 搜索函