2023年2月18日

欧拉筛分解质因子板子

摘要: int p[N], pe[N], primes[N], cnt; void init() { for (int i = 2; i < N; i++ ) { if(!p[i]) p[i] = i, pe[i] = i, primes[++ cnt] = i; for (int j = 1; j <= 阅读全文

posted @ 2023-02-18 10:24 zesure 阅读(8) 评论(0) 推荐(0) 编辑

2023年2月17日

D. Triangle Coloring (组合数)

摘要: #pragma GCC optimize ("O3") #pragma GCC optimize ("O2") #pragma GCC optimize ("O1") #include <bits/stdc++.h> typedef long long ll; typedef unsigned lo 阅读全文

posted @ 2023-02-17 15:30 zesure 阅读(53) 评论(0) 推荐(0) 编辑

2022年6月11日

E. Price Maximization(贪心)

摘要: 题面 思路:(a+b)/k=a/k+b/k,所以总和可以先用对每一个数字除k加起来 部分数字不是k的倍数,但两两配合后是k倍数,这样相当于我们损失了一个cnt,所以最后我们要找出有多少个这样的配对,最后答案加上配置数量即可 阅读全文

posted @ 2022-06-11 10:04 zesure 阅读(50) 评论(0) 推荐(0) 编辑

2022年6月10日

C - Table Decorations

摘要: 思路:一眼贪.jpg 不过讨论贪心的情况太多了就得考虑自己的思路是否错了,一些trick自己想不到还是得自己多做题积累 对于能够组成桌子的情况,分为abc和abb两种,桌子分得最多就代表着剩余的差值最少(对于大部分贪心问题而言,题目给出的条件到最后一般都为另一种条件的体现,如何正确地理解问题本质是解 阅读全文

posted @ 2022-06-10 20:56 zesure 阅读(24) 评论(0) 推荐(1) 编辑

2022年6月9日

机组期末笔记

摘要: 可执行文件存储映像 2,.o是可重定位文件 3,未初始化信息在bss节,否则送到data节 4,rodata是只读数据(const) 5, 6, 7, 阅读全文

posted @ 2022-06-09 14:04 zesure 阅读(31) 评论(0) 推荐(0) 编辑

2022年6月5日

python笔记

摘要: 1,#单行注释,''' '''多行注释 2,input输入值为str 3,避免小数位数过多 from decimal import Decimal print(Decimal('1.1')+Decimal('2.2')) 4,一次性读入多个数据 a, b, c = input('输入a,b空格隔开: 阅读全文

posted @ 2022-06-05 19:14 zesure 阅读(19) 评论(0) 推荐(0) 编辑

线段树板子题自用

摘要: 思路:单点修改,区间查询 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int INF=0xffffff0; const int maxn=10 阅读全文

posted @ 2022-06-05 15:46 zesure 阅读(21) 评论(0) 推荐(0) 编辑

2022年6月2日

AtCoder Beginner Contest 128 D - equeue

摘要: #include<stdio.h> #include<math.h> #include<string.h> #include<ctype.h> #include<iostream> #include<algorithm> #include<vector> #include<queue> typede 阅读全文

posted @ 2022-06-02 13:04 zesure 阅读(25) 评论(0) 推荐(0) 编辑

2022年5月30日

Codeforces Round #703 (Div. 2)

摘要: B 思路:结论题,如果点是奇数,这个点只能为1 否则等于中间最短点之间的差值+1 #include<stdio.h> #include<math.h> #include<string.h> #include<ctype.h> #include<iostream> #include<algorithm 阅读全文

posted @ 2022-05-30 20:22 zesure 阅读(26) 评论(0) 推荐(0) 编辑

树状数组笔记

摘要: lowbit:保留数在2进制下最后一个1,前面全变0 模板1:单点修改,区间查询 # include <bits/stdc++.h> using namespace std; typedef long long ll; int n[500009]; int t,k; int lowbit(int m 阅读全文

posted @ 2022-05-30 20:17 zesure 阅读(16) 评论(0) 推荐(0) 编辑

导航