摘要: #include <iostream> #include <cstdio> #include <queue> #include <vector> #define ll long long using namespace std; /* 注意: 输出不同可能对齐参数或者编译器不同有关。 */ //模板 阅读全文
posted @ 2023-04-21 17:09 ztlsw 阅读(15) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<string> #include<set> #include<time.h> #include<cstring> #include <vector> #define LL long long #define MAXN 100010 using 阅读全文
posted @ 2023-04-20 16:11 ztlsw 阅读(17) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<string> #include<set> #include<time.h> #include<cstring> #include <vector> #define LL long long #define MAXN 100010 using 阅读全文
posted @ 2023-04-19 22:05 ztlsw 阅读(25) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<string> #include<set> #include<time.h> using namespace std; /* 前置知识: 对于函数类型,非重写隐藏,重写(virtual)覆盖 对于变量,是隐藏 被隐藏的属性,在子类被强制转换成父 阅读全文
posted @ 2023-04-17 09:56 ztlsw 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 战绩: A. Technical Support 出现问题就要有答案,直接模拟。 int main() { read(T); while(T--) { cin>>n; cin>>s; q=0; for(int i=0;i<n;i++) { if(s[i]=='Q') q++; if(s[i]=='A 阅读全文
posted @ 2022-11-10 22:38 ztlsw 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 战绩: A. Password 列出所有可能的形式,包括AABB,ABAB,ABBA三种,然后在所有可行的数字中选两个进行排列,答案即$3*P_n^2$ 当然暴力打表也是可以的,这题居然卡了那么久。 int main() { read(T); while(T--) { read(n); for(in 阅读全文
posted @ 2022-10-20 10:28 ztlsw 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 战绩: A. Make A Equal to B 实际上就只有两种操作可能,一种是遇到了不同的位置直接换,一种是换出0和1一样的个数后重新排列顺序,两种操作比较最小值输出。 int main() { cin>>T; while(T--) { cin>>n; for(int i=1;i<=n;i++) 阅读全文
posted @ 2022-10-14 11:37 ztlsw 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 战绩: 打到一半被叫走,回来后断断续续打完的。。。 A. Burenka Plays with Fractions 刚开始感觉被trick绕进去了,思路有点乱,就先去切B了。 实际上如果要a/b=c/d,我们只用判断a*d和b*c的关系就好。 注意判断0的情况。 int main() { cin>> 阅读全文
posted @ 2022-08-19 11:22 ztlsw 阅读(45) 评论(0) 推荐(0) 编辑
摘要: 战绩: 有铁头娃 A. Chip Game 猜了个结论,第一次猜的是n==m,第二次猜的是n+m的奇偶性。 严格证明也比较简单。 由于只能向右向上,我们每次移动相当于缩减问题规模。 那么n和m两个都为奇数或者偶数的情况下,能够移动到一奇一偶的情况,而一奇一偶的情况也能移动到两个都为奇数或者偶数的状态 阅读全文
posted @ 2022-08-18 19:30 ztlsw 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 战绩: A. Wonderful Permutation 签到题。 计算前k个就把最小的那k个转移到前k项,看数组前k项缺多少最小前k项就行,可以在O(k)的复杂度内解决。 int main() { read(T); while(T--) { read(n);read(k); for(int i=1 阅读全文
posted @ 2022-08-14 11:33 ztlsw 阅读(36) 评论(0) 推荐(0) 编辑