当前位置:网站首页>Codeforces Round #796 (Div. 2) (A-D)
Codeforces Round #796 (Div. 2) (A-D)
2022-07-31 15:15:00 【eyuhaobanga】
tnnd, why not AKdiv2?(It's not because I don't know how to do it + less time, so much knowledge, I didn't learn QAQ
AC Code:
#include#define rep(i,a,n) for(int i=a;i > x;for (int i = 1; i <= 30; i++) {if (x == (1 << i)) {cout << x + 1 << "\n";return;}}int y = x & (-x);while ((y ^ x) == 0 || (y & x) == 0) {y++;}cout << y << '\n';}int main() {ios::sync_with_stdio(false);cin.tie(nullptr);int T;cin >> T;rep(i, 0, T) {Solve();}return 0;} AC Code:
#include#define rep(i,a,n) for(int i=a;i > n;int cnt = 0;vector a(n);int ans = 0x3f3f3f3f;for (int i = 0; i < n; i++) {cin >> a[i];if (a[i] % 2 == 1) {cnt++;}}if (cnt) {ans = min(ans, n - cnt);}int sum = 0x3f3f3f3f;for (int i = 0; i < n; i++) {int x = 0;if (a[i] % 2 == 0) {while (a[i] % 2 != 1) {x++;a[i] >>= 1;}}sum = min(sum, x);}cout << min(ans, sum + n - 1) << '\n';}int main() {ios::sync_with_stdio(false);cin.tie(nullptr);int T;cin >> T;rep(i, 0, T) {Solve();}return 0;} AC Code:
#include#define rep(i,a,n) for(int i=a;i > n;n <<= 1;vector a(n);map mp;for (int i = 0; i < n; i++) {cin >> a[i];int len = a[i].size();for (int j = 0; j < len; j++) {mp[a[i][j]]++;}}string s;cin >> s;int len = s.size();for (int i = 0; i < len; i++) {mp[s[i]]++;}for (auto it : mp) {if (it.second % 2 == 1) {cout << it.first << '\n';return;}}}int main() {ios::sync_with_stdio(false);cin.tie(nullptr);int T;cin >> T;rep(i, 0, T) {Solve();}return 0;} AC Code:
#include#define rep(i,a,n) for(int i=a;i > n >> k;vector a(n);vector sum(n);rep (i, 0, n) {cin >> a[i];if (i == 0) {sum[i] = a[i];}else {sum[i] = a[i] + sum[i - 1];}}int x = k / n;int y = k - x * n;LL ans = 0;if (x == 0) {for (int i = k - 1; i < n; i++) {if (i >= k) {ans = max(ans, sum[i] - sum[i - k]);}else {ans = max(ans, sum[i]);}}cout << ans + 1LL * k * (k - 1) / 2 << '\n';return;}for (int i = 0; i < n; i++) {ans += 1LL * a[i] + i;}x--;ans += 1LL * n * x * n;ans += 1LL * y * n;cout << ans << '\n';}int main() {ios::sync_with_stdio(false);cin.tie(nullptr);int T;cin >> T;rep(i, 0, T) {Solve();}return 0;}
边栏推荐
- Doing things software development - the importance of law and understanding of reasonable conclusions
- R language ggplot2 visualization: use the ggboxplot function of the ggpubr package to visualize the grouped box plot, use the ggpar function to change the graphical parameters (caption, add, modify th
- 双边滤波加速「建议收藏」
- Kubernetes原理剖析与实战应用手册,太全了
- 力扣:56. 合并区间
- OpenCV测量物体的尺寸技能 get~
- abaqus find contact pairs报错:surface name is already in use
- OpenShift 4 - Customize RHACS security policies to prevent production clusters from using high-risk registry
- LeetCode二叉树系列——226.翻转二叉树
- 腾讯云部署----DevOps
猜你喜欢

AVH Deployment Practice (1) | Deploying the Flying Paddle Model on Arm Virtual Hardware

名创优品斥资6.95亿购买创始人叶国富所持办公楼股权

NC | 中国农大草业学院杨高文组揭示发现多因子干扰会降低土壤微生物多样性的积极效应...

Message queue data storage MySQL table design

Getting started with UnityShader (3) - Unity's Shader

为什么毕业季不要表白?

Essential Learning for Getting Started with Unity Shader - Transparency Effect

WPF项目--控件入门基础用法,必知必会XAML

OpenCV测量物体的尺寸技能 get~

2021 OWASP TOP 10 Vulnerability Guide
随机推荐
R language test whether the sample conforms to normality (test whether the sample comes from a normally distributed population): shapiro.test function tests whether the sample conforms to the normal d
深入浅出边缘云 | 4. 生命周期管理
RecyclerView高效使用第三节
女性服务社群产品设计
模板与泛型编程值typelist实现
基于极限学习机(ELM)进行多变量用电量预测(Matlab代码实现)
R language ggplot2 visualization: use the ggboxplot function of the ggpubr package to visualize the box plot, use the font function to customize the font size, color, style (bold, italic) of the legen
安装Xshell并使用其进行Ymodem协议的串口传输
分成两栏后文字顺序混乱的问题解决【写期刊论文时】
Kubernetes原理剖析与实战应用手册,太全了
TCP详解
Destruction order of thread_local variables
学习笔记12--路径-速度分解法之局部路径搜索
2021 OWASP TOP 10 Vulnerability Guide
OpenCV测量物体的尺寸技能 get~
The meaning of node_exporter performance monitoring information collection in Prometheus
JVM parameter analysis Xmx, Xms, Xmn, NewRatio, SurvivorRatio, PermSize, PrintGC "recommended collection"
svn安装及使用(身体功能手册)
Jmeter常用的十大组件
修改SQL语言实现Mysql 多表关联查询优化