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. 【IEEE 出版】 第三届能源与电力系统国际学术会议 (ICEEPS 2024)

    [连续2届会后4-5个月EI检索,检索稳定!特邀院士.Fellow 报告!]第三届能源与电力系统国际学术会议 (ICEEPS 2024)以"创造更加柔性.智能的能源电力系统"为主题 ...

  2. zabbix---监控Oracle12c数据库

    使用插件:orabbix用于监控oracle实例的zabbix插件 orabbix插件下载地址:http://www.smartmarmot.com/product/orabbix/download/ ...

  3. Linux 时间 与 定时器

    背景 在学习 Linux 信号 有关知识中,提到了 alarm函数. 进程时间 (原文地址:https://www.cnblogs.com/clover-toeic/p/3845210.html) 进 ...

  4. 3562-Qt工程编译说明

  5. TI AM64x工业核心板规格书(双核ARM Cortex-A53 + 单/四核Cortex-R5F + 单核Cortex-M4F,主频1GHz)

    1 核心板简介 创龙科技SOM-TL64x是一款基于TI Sitara系列AM64x双核ARM Cortex-A53 + 单/四核Cortex-R5F + 单核Cortex-M4F设计的多核工业级核心 ...

  6. SpringBoot配置文件的优先级

    配置文件优先级 (1)命令行参数: (2)java:comp/env的JNDI属性(当前J2EE应用的环境): (3)JAVA系统的环境属性: (4)操作系统的环境变量: (5)JAR包外部的appl ...

  7. [oeasy]python0127_中文系统_gbk_BIG5_南极星_内码转化

    中文系统bgk 回忆上次内容 汉字字形通过 点阵式打字机 像素级寻址的屏幕 进入了计算机的世界   ​   添加图片注释,不超过 140 字(可选)   在海峡对岸的台湾同胞 也进入了汉字时代   他 ...

  8. [oeasy]python0045_转化为10进制数_int_integrate_integer_entire_整数

    转化为10进制 回忆上次内容 上这次总结了四种进制 函数名 对应单词 进制类型 数字事例 前缀 bin() binary 2 0b1100001 0b oct() octal 8 0o141 0o h ...

  9. vuex使用和场景案例

    vuex是vue提供的一个集中式状态管理器,用于对数据的集中式管理. vuex有四个重要的属性:state.mutations.actions.getters 1.vuex的使用 安装 npm ins ...

  10. ABC347

    A link 很简单 遍历,判断模\(k\)是否为\(0\),如果为\(0\),输出\(a_i/k\). 点击查看代码 #include<bits/stdc++.h> using name ...