06 2023 档案

摘要:题目链接 因为都是有官方题解的,咱这个蒟蒻就在记录一下赛时通过以及后来补得一些题😢 A. 旷野之息 考虑将一个人 \(i\)选上对答案的贡献,即\(\frac{a_i}{\sum a} - \frac{1}{n}\),若贡献大于 \(0\),将其加上即可。 需要预处理 \(\sum a\),时间复 阅读全文
posted @ 2023-06-26 21:46 Ke_scholar 阅读(376) 评论(0) 推荐(0)
摘要:A. 选择 多造几组数据可以发现 ​ \(dp[n] = dp[n / 2] + 1\). 假如一个序列为\(\{1,2,\cdots,n\}\),那我们从\(n/2\)后都减去\(n/2\),序列就变为了\(\{1,2,\cdots,n/2,1,2,\cdots,n/2\}\),那么我们只需要\( 阅读全文
posted @ 2023-06-26 20:57 Ke_scholar 阅读(126) 评论(0) 推荐(0)
摘要:A. Programming Contest 签到题. 输入输出读完应该就懂了: 从y1枚举到y2,若枚举的年份不在停办年份里则答案加一 void solve() { int n,m; cin >> n; vector<int> a(N),year(N); cin >> m; for(int i = 阅读全文
posted @ 2023-06-26 17:28 Ke_scholar 阅读(19) 评论(0) 推荐(0)
摘要:E. Expenditure Reduction 从左右往右找到包含B字符的最近位置,然后从这个位置有从右到左找回去找到包含完所有B字符的位置,这个区间就是答案 #include <bits/stdc++.h> #define inf 0x3f3f3f3f #define endl '\n' #de 阅读全文
posted @ 2023-06-24 17:22 Ke_scholar 阅读(14) 评论(0) 推荐(0)
摘要:题目链接 Problem A. Drill Wood to Make Fire S * V >= n即可 #include<bits/stdc++.h> #define int long long #define endl '\n' using namespace std; const int N 阅读全文
posted @ 2023-06-01 23:06 Ke_scholar 阅读(43) 评论(0) 推荐(0)
摘要:A. Antiamuny wants to learn binary search 签到题. #include <map> #include <set> #include <cmath> #include <queue> #include <stack> #include <cstdio> #inc 阅读全文
posted @ 2023-06-01 22:03 Ke_scholar 阅读(87) 评论(0) 推荐(0)
摘要:A. The Text Splitting 题意:给出字符串长度,给出p和q两种切割方式,任选其中一种,把字符串分割输出结果。 题解:先进行判断,p和q是否能整个的分割n,利用p和q的函数关系判断(见代码),再计算有几个p几个q,再进行输出即可 void solve() { cin >> n >> 阅读全文
posted @ 2023-06-01 18:12 Ke_scholar 阅读(16) 评论(0) 推荐(0)