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 ...
随机推荐
- QT学习:02 界面布局管理
--- title: framework-cpp-qt-02-界面布局管理 EntryName: framework-cpp-qt-02-ui-layout-manage date: 2020-04- ...
- Python读取YAML配置数据
python编写的一些脚本需要一些简单配置时可以使用yaml文件进行设置.本文将介绍如何使用pyyaml进行读取配置数据. 首先安装pyyaml pip install pyyaml 简单使用下pyy ...
- P1546
[USACO3.1]最短网络 Agri-Net 题意描述 FJ 已经给他的农场安排了一条高速的网络线路,他想把这条线路共享给其他农场.为了用最小的消费,他想铺设最短的光纤去连接所有的农场. 你将得到一 ...
- LabVIEW的自定义按钮
下载几张图片: 比较好的 网站1:https://www.iconfont.cn/ 网站2:https://yesicon.app/ 选用windows风格按钮控件进行自定义, 自定义的图片分别放入这 ...
- 基础-数组_C语言
C 语言支持数组数据结构,它可以存储一个固定大小的相同类型元素的顺序集合.数组是用来存储一系列数据,但它往往被认为是一系列相同类型的变量. 数组的声明并不是声明一个个单独的变量,比如 runoob0. ...
- Python threading实现多线程 提高篇 线程同步,以及各种锁
本文主要讲多线程的线程之间的资源共享怎么保持同步. 多线程基础篇见,Python threading实现多线程 基础篇 Python的多线程,只有用于I/O密集型程序时效率才会有明显的提高,如文件/输 ...
- ipa文件上传到app store的构建版本的工具
打包好ipa文件后,可以使用mac电脑上的xcode将ipa上传到app store的构建版本中,假如没有mac电脑,可以使用香蕉云编来将ipa文件上传到构建版本. 这里我们来介绍下ipa文件上传到a ...
- .NET 窗口/屏幕截图
图像采集源除了显示控件(上一篇<.NET 控件转图片>有介绍从界面控件转图片),更多的是窗口以及屏幕. 窗口截图最常用的方法是GDI,直接上Demo吧: 1 private void Gd ...
- 06 定时器和PWM(1)
前言 前面介绍了一下外部中断,这一节主要介绍一下内部定时器和PWM,这两个知识还是比较重要的. 一.定时器 1.什么是定时器 定时器其实和计数器一样,我们通过设置一个值,当计数器运行一个计数寄存器向上 ...
- 【Java】线程池配置
先看JUC包自带的一个资源 线程池执行器: 初始化参数如下 ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor( corePo ...