摘要: 补码 1. 用二进制表示正数或负数 任何一个$10$进制数,都可以转化为$2$进制数,并且只需要增加一个符号位$0/1$就可以描述数的正负了。 如 \((2)_{10} = (010)_{2} , (-2)_{10}=(110)_2\) 如果给输入的数据加入大概的范围,如$[-127,128]$,那 阅读全文
posted @ 2021-08-13 14:34 Maystern 阅读(224) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round #737 (Div. 2) A - Ezzat and Two Subsequences 给出$n$个数分成非空的两组,输出两组分别的平均数之和的最大值。 对于$100%$的数据$1 \leq n\leq 3\times 10^5$ 将最大数单独作为一组,其他数作为 阅读全文
posted @ 2021-08-11 00:14 Maystern 阅读(166) 评论(0) 推荐(0) 编辑
摘要: C++字符串语法学习 String 类 1.0 源 STL中basic_string类实例化 1.1 构造方法 string s1; // s1 = "" string s2("Hello"); // s2 = "Hello" string s3(4,'K'); // s3 = "KKKK" str 阅读全文
posted @ 2021-08-09 13:15 Maystern 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Excellent Ideas CF E - Permutation Shift 通过交换两个数的操作,使得一个排列$a$转变成另外一个排列$b$,求最少的交换次数。 对于每一个$i$连一条$a_i$和$b_i$的双向边,在图中求联通块数量$c$,最少交换次数为$n-c$。 CF F - Pairw 阅读全文
posted @ 2021-08-02 13:32 Maystern 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 近期训练计划 2021年8月2日 紫书语言篇第3章“数组和字符串”3.1-3.3。 计算机科学导论 复习计算机历史、数字系统 计算机科学导论 第4章数据运算 最近在cf上比赛结果不是很好,Div3一般只能做$4-5$题,Div2一般只能做$2-3$题。 要多刷Rating 1600左右的试题,争取在 阅读全文
posted @ 2021-08-02 01:14 Maystern 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 打造BUG FREE程序 1.[codeforces #736 Div2 B]:int型变量$n$定义在字符串的char类型中,导致$n$溢出。 2. 日常学习、编译时 : 求和问题,有可能爆int,此时应该用define int long long。 3. [codeforces #736 Div 阅读全文
posted @ 2021-08-02 01:08 Maystern 阅读(38) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round #733 (Div. 1 + Div. 2) A - Binary Decimal 定义好数为各位是$0$或者$1$的十进制数。 给出数$n$,求出最少的好数的数量,使得这些好数相加恰好为$n$ 对于$100%$的数据满足$1 \leq n \leq 10^9$ 注 阅读全文
posted @ 2021-08-01 15:02 Maystern 阅读(49) 评论(0) 推荐(0) 编辑
摘要: Educational Codeforces Round 112 (Rated for Div. 2) A - PizzaForces 有$3$种规格的pizza,分别有$6,8,10$块,需要烤制的时间分别为$15,20,25$。 若要至少获得$n$块,则最小烤制时间为多少。 对于$100%$的数 阅读全文
posted @ 2021-07-31 12:35 Maystern 阅读(51) 评论(0) 推荐(0) 编辑
摘要: Educational Codeforces Round 111 Problem A. Find The Array 找到长度最小且为$n$的数组$a_n$,使之满足: 对于$1 \leq i \leq n$,有$a_i=1$或者$a_-1,a_i-2 \in {a_n},\sum a_i = s$ 阅读全文
posted @ 2021-07-17 21:55 Maystern 阅读(82) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round #732 (Div. 2) Problem A. AquaMoon and Two Arrays 数组$a_n,b_n$由非负整数组成,要求一个方案让$a_n$按下列规则变化后等于$b_n$ 选择$(i,j)$后操作:\(a'_i = a_i - 1 , a'_j 阅读全文
posted @ 2021-07-14 20:21 Maystern 阅读(63) 评论(0) 推荐(0) 编辑