SMU Summer 2023 Contest Round 13
SMU Summer 2023 Contest Round 13
A. Review Site
我们总是可以把差评放到另一个服务器,好评和中立放另一个,这样最多投票数就是好评与中立数
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
vector<int> r(n);
int ans = 0;
for (auto &i : r) {
cin >> i;
ans += (i != 2);
}
cout << ans << '\n';
}
return 0;
}
B. GCD Length
就是去凑\(a\)和\(b\)都有\(c\)个相同因子就行,我这里凑得相同因子是\(11\),然后\(a\)一直乘\(2\)到对应位数,\(b\)一直乘\(3\)到对应位数
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int, int> PII;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
int a, b, c;
cin >> a >> b >> c;
int g = 0, cc = c;
while (cc > 0) {
g = g * 10 + 1;
cc--;
}
if (a == b && a == c) {
cout << g << ' ' << g << '\n';
} else {
int a1 = pow(10, a - 1), b1 = pow(10, b - 1), g1 = g, g2 = g;
while (g1 < a1) g1 *= 2;
while (g2 < b1) g2 *= 3;
cout << g1 << ' ' << g2 << '\n';
}
}
return 0;
}
C. Yet Another Card Deck
因为\(a_i\)最多只有\(50\),所以我们可以用一个桶去记录每个数第一次的位置,然后将某个数提前的时候就将这个数前面位置的都往后挪一位
#include<bits/stdc++.h>
using i64 = long long;
using namespace std;
typedef pair<i64, i64> PII;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,q;
cin >> n >> q;
vector<i64> a(n + 1);
vector<int> t(55);
for(int i = 1;i <= n;i ++){
cin >> a[i];
if(!t[a[i]]) t[a[i]] = i;
}
while(q--){
int x;
cin >> x;
cout << t[x] << ' ';
for(int i = 1;i <= 50;i ++){
if(i != x && t[i] < t[x])
t[i]++;
}
t[x] = 1;
}
return 0;
}
D. Min Cost String
观察第一个样例我们得出按照a ab ac ad b bc bd…这样去构造一个循环字符串即可满足要求
#include<bits/stdc++.h>
using i64 = long long;
using namespace std;
typedef pair<i64, i64> PII;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,k;
cin >> n >> k;
string ans = "";
for(int i = 'a';i < k + 'a';i ++){
ans += i;
for(int j = i + 1;j < k + 'a';j ++){
ans += i, ans += j;
}
}
for(int i = 0;i < n;i ++)
cout << ans[i % ans.size()];
cout << '\n';
return 0;
}
SMU Summer 2023 Contest Round 13的更多相关文章
- Codeforces Beta Round #13 C. Sequence (DP)
题目大意 给一个数列,长度不超过 5000,每次可以将其中的一个数加 1 或者减 1,问,最少需要多少次操作,才能使得这个数列单调不降 数列中每个数为 -109-109 中的一个数 做法分析 先这样考 ...
- Codeforces Beta Round #13 E. Holes 分块暴力
E. Holes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/13/problem/E Des ...
- 2019-2020 ACM-ICPC Brazil Subregional Programming Contest (11/13)
\(2019-2020\ ACM-ICPC\ Brazil\ Subregional\ Programming\ Contest\) \(A.Artwork\) 并查集,把检测区域能在一起的检测器放在 ...
- Educational Codeforces Round 13 D:Iterated Linear Function(数论)
http://codeforces.com/contest/678/problem/D D. Iterated Linear Function Consider a linear function f ...
- Educational Codeforces Round 13 E. Another Sith Tournament 状压dp
E. Another Sith Tournament 题目连接: http://www.codeforces.com/contest/678/problem/E Description The rul ...
- Educational Codeforces Round 13 D. Iterated Linear Function 水题
D. Iterated Linear Function 题目连接: http://www.codeforces.com/contest/678/problem/D Description Consid ...
- Educational Codeforces Round 13 C. Joty and Chocolate 水题
C. Joty and Chocolate 题目连接: http://www.codeforces.com/contest/678/problem/C Description Little Joty ...
- Educational Codeforces Round 13 B. The Same Calendar 水题
B. The Same Calendar 题目连接: http://www.codeforces.com/contest/678/problem/B Description The girl Tayl ...
- Educational Codeforces Round 13 A. Johny Likes Numbers 水题
A. Johny Likes Numbers 题目连接: http://www.codeforces.com/contest/678/problem/A Description Johny likes ...
- Educational Codeforces Round 13 A、B、C、D
A. Johny Likes Numbers time limit per test 0.5 seconds memory limit per test 256 megabytes input sta ...
随机推荐
- Linux高级命令
重定向 重定向也称为输出重定向,用于将命令的输出保存到目标文件. 使用方法:> 文件名 或 >> 文件名.前者会覆盖文件内容,后者会追加内容到文件. 查看文件内容命令 cat: 显示 ...
- SpringBoot指标监控功能
SpringBoot指标监控功能 随时查看SpringBoot运行状态,将状态以josn格式返回 添加Actuator功能 Spring Boot Actuator可以帮助程序员监控和管理Spring ...
- 【题解】CatOJ C0458C 滑动窗口定期重构
标题 trick 的名字我也不知道是什么,就这样吧. 首先有显然的 dp 式子:\(f(i)=\min \{f(j) \times \max\{a_{j+1},\dots,a_i\}\}\).考虑怎么 ...
- 实验10.3层vlan互通实验
# 实验10.三层Vlan互通实验 本实验是跨vlan路由的第二种形式,比第一种形式更常见常用一些. 需要用到三层交换机. 实验组 交换机配置 不同于以往,本次的交换机使用了三层交换的功能 SW vl ...
- 高通Android Cam-x Actuator Bring up
高通Android Camera Bring Up Actuator reference:https://blog.csdn.net/mr_zjc/article/details/105736925 ...
- CF911G 题解
考虑分块. 如果你做过未来日记就会知道一个很明显的做法--值域并查集. 先考虑整块: 块内没有 \(x\) 则跳过本次操作. 块内有 \(x\) 没有 \(y\) 则令 \(fa[x] = y\) 块 ...
- python3 podman库
前言 最近在使用 podman, 需要调用一些 podman的接口,podman官网提供的接口并不是很详尽,使用 unix.sock 的方式调用有一 些困难.后来测试 ai 工具时,其提供了一个比较好 ...
- FileZilia FATAL ERROR: Network error: Software caused connection abort
使用FileZilia sftp传文件,对象服务器突然关闭,导致FileZilia传输中断. 等待对象服务器打开后,使用FileZilia想继续传输文件,结果一直显示: FATAL ERROR: Ne ...
- [oeasy]python005_退出游乐场_重启游乐场_系统态shell_应用态_quit
退出终端_重启游乐场_shell_quit Python 回忆 上次 了解了 python 进入了 python 游乐场 在游乐场 可以做 简单的计算 还可以做 乘方运算 数字特别大之后 游乐 ...
- 2023 NOIP 游记
\(\text{Day -INF}\) 提高 \(135\) 卡线进 \(\text{NOIP}\). 集训两天成绩:\(50 \to 135\). \(\text{Day 1}\) 开赛 \(13\ ...