当前位置:网站首页>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;}
边栏推荐
- 修改SQL语言实现Mysql 多表关联查询优化
- 11 pinia use
- Ubantu project 4: xshell, XFTP connected the virtual machine and set xshell copy and paste the shortcut
- NC | 斯坦福申小涛等开发数据可重复分析计算框架TidyMass
- 435. 无重叠区间
- 格林美瑞交所IPO:募资3.8亿美元 更多中国企业将赴欧洲上市
- R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化分组箱图、使用ggpar函数改变图形化参数(caption、添加、修改可视化图像的题注、脚注内容)
- OpenCV测量物体的尺寸技能 get~
- R语言检验样本是否符合正态性(检验样本是否来自一个正态分布总体):shapiro.test函数检验样本是否符合正态分布(normality test)
- ASP.NET Core 产生连续 Guid
猜你喜欢
深入浅出边缘云 | 4. 生命周期管理
四象限时间管理有多好用?
【MySQL】Mysql范式及外键作用
Essential Learning for Getting Started with Unity Shader - Transparency Effect
11 pinia use
WPF项目--控件入门基础用法,必知必会XAML
网银被盗?这篇文章告诉你如何安全使用网银
AVH Deployment Practice (1) | Deploying the Flying Paddle Model on Arm Virtual Hardware
leetcode303场周赛复盘
国内市场上的BI软件,到底有啥区别
随机推荐
实现防抖与节流函数
WeChat chat record search in a red envelope
谷歌CTS测试(cta测试)
微信聊天记录中搜索红包
JVM parameter analysis Xmx, Xms, Xmn, NewRatio, SurvivorRatio, PermSize, PrintGC "recommended collection"
Node实现数据加密
Kubernetes原理剖析与实战应用手册,太全了
button控件的使用
mongo进入报错
ASP.NET Core 产生连续 Guid
Use of radiobutton
基于最小二乘法和SVM从天气预报中预测太阳能发电量(Matlab代码实现)
7. Summary of common interview questions
基于极限学习机(ELM)进行多变量用电量预测(Matlab代码实现)
Web自动化实战——Selenium4(自动化测试环境的搭建)
TRACE32 - Common Operations
Introductory UnityShader learning (2) - the rendering pipeline
三、数组
Why don't you make a confession during the graduation season?
R语言的画图代码及差异性分析[通俗易懂]