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的更多相关文章

  1. Codeforces Beta Round #13 C. Sequence (DP)

    题目大意 给一个数列,长度不超过 5000,每次可以将其中的一个数加 1 或者减 1,问,最少需要多少次操作,才能使得这个数列单调不降 数列中每个数为 -109-109 中的一个数 做法分析 先这样考 ...

  2. Codeforces Beta Round #13 E. Holes 分块暴力

    E. Holes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/13/problem/E Des ...

  3. 2019-2020 ACM-ICPC Brazil Subregional Programming Contest (11/13)

    \(2019-2020\ ACM-ICPC\ Brazil\ Subregional\ Programming\ Contest\) \(A.Artwork\) 并查集,把检测区域能在一起的检测器放在 ...

  4. Educational Codeforces Round 13 D:Iterated Linear Function(数论)

    http://codeforces.com/contest/678/problem/D D. Iterated Linear Function Consider a linear function f ...

  5. Educational Codeforces Round 13 E. Another Sith Tournament 状压dp

    E. Another Sith Tournament 题目连接: http://www.codeforces.com/contest/678/problem/E Description The rul ...

  6. Educational Codeforces Round 13 D. Iterated Linear Function 水题

    D. Iterated Linear Function 题目连接: http://www.codeforces.com/contest/678/problem/D Description Consid ...

  7. Educational Codeforces Round 13 C. Joty and Chocolate 水题

    C. Joty and Chocolate 题目连接: http://www.codeforces.com/contest/678/problem/C Description Little Joty ...

  8. Educational Codeforces Round 13 B. The Same Calendar 水题

    B. The Same Calendar 题目连接: http://www.codeforces.com/contest/678/problem/B Description The girl Tayl ...

  9. Educational Codeforces Round 13 A. Johny Likes Numbers 水题

    A. Johny Likes Numbers 题目连接: http://www.codeforces.com/contest/678/problem/A Description Johny likes ...

  10. 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 ...

随机推荐

  1. Linux Driver : i2c-gpio

    # Linux Driver : i2c-gpio https://www.cnblogs.com/haoxing990/p/4718834.html https://blog.csdn.net/ji ...

  2. 专用M4F+四核A53,异构多核AM62x让工业控制“更实时、更安全” Tronlong创龙科技5 秒前 1 德州仪器 TI芯片

    Cortex-M4F + Cortex-A53异构多核给工业控制带来何种意义? 创龙科技SOM-TL62x工业核心板搭载TI AM62x最新处理器,因其Cortex-M4F + Cortex-A53异 ...

  3. 实现Quartz.NET的HTTP作业调度

    Quartz.NET作为一个开源的作业调度库,广泛应用于.NET应用程序中,以实现复杂的定时任务,本次记录利用Quartz.NET实现HTTP作业调度,通过自定义HTTP作业,实现对外部API的定时调 ...

  4. SpringBoot 对接美团闪购,检验签名,获取推送订单参数,text转json

    接口文档地址 订单推送(已确定订单):https://open-shangou.meituan.com/home/docDetail/177 签名算法:https://opendj.meituan.c ...

  5. 在MoneyPrinterPlus中使用本地chatTTS语音模型

    之前MoneyPrinterPlus在批量混剪,一键AI生成视频这些功能上的语音合成功能都用的是云厂商的语音服务,比阿里云,腾讯云和微软云. 云厂商虽然提供了优质的语音服务,但是用起来还是要收费. 为 ...

  6. WebGL实践之半透阴影

    楔子 相信很多人都知道,通过ShadowMap可以产生阴影,通过渲染阴影可以增加场景渲染的对比度,增加渲染的真实效果. 如下图所示: 但是对于透明或者半透明的对象,WebGL在处理阴影效果的时候,会把 ...

  7. microsoft office object版本对应offices版本

    1997年 Excel 97 Microsoft Excel 8.0 1999年 Excel 2000 Microsoft Excel 9.0 2001年 Excel XP Microsoft Exc ...

  8. SQL Server 验证某栏位是否存在某字符串(CHARINDEX)

    SELECT * FROM LiuJun_PKqitchqi WHERE CHARINDEX('230527Z3258',qr_code) > 0

  9. lvs的nat和dr模式混合用

    机器部署信息 lvs : 10.0.0.200  vip 10.0.0.19 外网IP , 172.168.1.19 内网IP dr rs: 10.0.0.200 vip 10.0.0.18 rip ...

  10. ComfyUI进阶:Comfyroll插件 (五)

    ComfyUI进阶:Comfyroll插件 (五) 前言: 学习ComfyUI是一场持久战,而Comfyroll 是一款功能强大的自定义节点集合,专为 ComfyUI 用户打造,旨在提供更加丰富和专业 ...