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. 上交大开源镜像站下架 Docker Hub 镜像

    ​ 在现代软件开发中,Docker镜像已经成为不可或缺的工具.然而,最近频频出现的Docker镜像下架事件让许多开发者措手不及.突然失去依赖的镜像,不仅打乱了项目进程,还引发了许多不便.那么,面对Do ...

  2. PySide6之多线程

    一.QThread 方法1:子类化创建多线程 创建子线程,继承自QThread类 在子线程中自定义信号 在子线程中重写 run() 方法,进行信号的触发 在主线程中实例化子线程 在主线程中对子线程的信 ...

  3. 浏览器中JS的执行

    JS是在浏览器中运行的,浏览器为了运行JS, 必须要编译或解释JS,因为JS是高级语言,计算机不认识,必须把它编译或解释成机器语言,其次,在运行JS的过程,浏览器还要创建堆栈,因为程序是在栈中执行,执 ...

  4. 使用docker搭建ELK分式日志同步方案

    ELK作为业界最常用日志同步方案,我们今天尝试一下使用docker快速搭建一套ELK方案.ELK使用国内加速源拉取的镜像比较旧,有条件的朋友可以拉取官网的源.elasticsearch作为日志储存库( ...

  5. WTM的项目中EFCore如何适配人大金仓数据库

    一.WTM是什么 WalkingTec.Mvvm框架(简称WTM)最早开发与2013年,基于Asp.net MVC3 和 最早的Entity Framework, 当初主要是为了解决公司内部开发效率低 ...

  6. Blazor Server App Cannot find the fallback endpoint specified by route values

    github官方issues中提到的解决方案,CreateBuilder时指定项目绝对路径可以解决. 1 // 指定项目路径,也可以用Assembly.GetCallingAssembly获取 2 c ...

  7. 【java深入学习第2章】Spring Boot 结合 Screw:高效生成数据库设计文档之道

    在开发过程中,数据库设计文档是非常重要的,它可以帮助开发者理解数据库结构,方便后续的维护和扩展.手动编写数据库设计文档不仅耗时,而且容易出错.幸运的是,可以使用Spring Boot和Screw来自动 ...

  8. KubeCube 用户管理与身份认证

    前言 KubeCube (https://kubecube.io) 是由网易数帆近期开源的一个轻量化的企业级容器平台,为企业提供 kubernetes 资源可视化管理以及统一的多集群多租户管理功能.K ...

  9. mysql order by 造成语句 执行计划中Using filesort,Using temporary相关语句的优化解决

    mysql> explain  select permission.* from t_rbac_permission   permission  inner JOIN  t_rbac_acl   ...

  10. ASP.NET Core 3.x 三种【输入验证】方式

    验证要做三件事 定义验证规则 按验证规则进行检查 报告验证的错误. 在把错误报告给API消费者的时候,报告里并不包含到底是服务端还是API消费者引起的错误,这是状态码的工作.而通常响应的Body里面会 ...