当前位置:网站首页>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;}
边栏推荐
- 自适应控制——仿真实验二 用Narendra方案设计模型参考自适应系统
- The R language ggstatsplot package ggbarstats function visualizes bar charts, and adds hypothesis test results (including sample number, statistics, effect size and its confidence interval, significan
- R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化分组箱图、使用ggpar函数改变图形化参数(caption、添加、修改可视化图像的题注、脚注内容)
- Unity中实现点选RenderTexture中的3D模型
- TCP详解
- RecyclerView的高效使用第一节
- 11 pinia use
- 力扣:56. 合并区间
- TRACE32——C源码关联
- R语言检验样本是否符合正态性(检验样本是否来自一个正态分布总体):shapiro.test函数检验样本是否符合正态分布(normality test)
猜你喜欢

OpenShift 4 - Customize RHACS security policies to prevent production clusters from using high-risk registry

TRACE32 - C source code association

AVH部署实践 (一) | 在Arm虚拟硬件上部署飞桨模型

Public Key Retrieval is not allowed error solution when DBeaver connects to MySQL 8.x

工程流体力学复习

四象限时间管理有多好用?

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

TRACE32 - SNOOPer-based variable logging

最小费用最大流问题详解

NC | 斯坦福申小涛等开发数据可重复分析计算框架TidyMass
随机推荐
删除表格数据或清空表格
自适应控制——仿真实验二 用Narendra方案设计模型参考自适应系统
Gorm—Go language database framework
基于最小二乘法和SVM从天气预报中预测太阳能发电量(Matlab代码实现)
NC | 中国农大草业学院杨高文组揭示发现多因子干扰会降低土壤微生物多样性的积极效应...
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
The R language ggstatsplot package ggbarstats function visualizes bar charts, and adds hypothesis test results (including sample number, statistics, effect size and its confidence interval, significan
JVM parameter analysis Xmx, Xms, Xmn, NewRatio, SurvivorRatio, PermSize, PrintGC "recommended collection"
谷歌CTS测试(cta测试)
json到底是什么(c# json)
【MySQL】Mysql范式及外键作用
乡村基冲刺港交所:5个月期内亏2224万 SIG与红杉中国是股东
Linux check redis version (check mongodb version)
WeChat chat record search in a red envelope
charles进行弱网测试(app弱网测试怎么做)
力扣:714. 买卖股票的最佳时机含手续费
数据库的范式(第一范式,第二范式,第三范式,BCNF范式)「建议收藏」
《微信小程序-进阶篇》Lin-ui组件库源码分析-Icon组件
DBeaver连接MySQL 8.x时Public Key Retrieval is not allowed 错误解决
ASP.NET Core 产生连续 Guid