当前位置:网站首页>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;}
边栏推荐
- 使用 PyTorch 检测眼部疾病
- 如何进行需求分析评审
- 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
- NC | 中国农大草业学院杨高文组揭示发现多因子干扰会降低土壤微生物多样性的积极效应...
- Codeforces Round #796 (Div. 2)(A-D)
- DBeaver连接MySQL 8.x时Public Key Retrieval is not allowed 错误解决
- 基于极限学习机(ELM)进行多变量用电量预测(Matlab代码实现)
- Jmeter常用的十大组件
- PDF 拆分/合并
- 7. Summary of common interview questions
猜你喜欢
随机推荐
Emmet 语法
分成两栏后文字顺序混乱的问题解决【写期刊论文时】
Matlab矩阵基本操作(定义,运算)
Ubantu project 4: xshell, XFTP connected the virtual machine and set xshell copy and paste the shortcut
01 Encounter typescript, build environment
Essential Learning for Getting Started with Unity Shader - Transparency Effect
[MySQL] Mysql paradigm and the role of foreign keys
Jmeter常用的十大组件
工程力学复习资料
Female service community product design
Node实现数据加密
org.apache.jasperException(could not initialize class org)
Excel快速对齐表格的中姓名(两个字姓名和三个字姓名对齐)
AVH部署实践 (一) | 在Arm虚拟硬件上部署飞桨模型
修改SQL语言实现Mysql 多表关联查询优化
TextBlock控件入门基础工具使用用法,取上法入门
Small test knife: Go reflection helped me convert Excel to Struct
Gorm—Go语言数据库框架
Introductory UnityShader learning (2) - the rendering pipeline
ASP.NET Core 产生连续 Guid







