上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页
摘要: 可以把这道题看成一个只有 一种运算符的表达式求值 #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #define For(i, j, n) for(int i = j ; i <= n ; + 阅读全文
posted @ 2024-01-17 17:30 Gold_stein 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 注意要把map[0]设置为1,因为根据题意,长度为1 的区间也要算进来 完整代码: #include <iostream> #include <map> #define int long long using namespace std; map <int, int> mp; //记录每个余数出现个 阅读全文
posted @ 2024-01-11 22:30 Gold_stein 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 1.首先想到的错解 看到数据范围,就想先写个n^2的暴力:先把所有矩形的面积都算出来,然后再把所有重合的部分挨个减去,把每个重合的部分当成一个个小矩形,用set来判重。 画一个稍复杂些的样例,就会发现,在这些由重合部分产生的小矩形之间,仍有重合,所以这种算法,会导致算出来的重合部分偏大,而导致最后的 阅读全文
posted @ 2023-12-26 12:44 Gold_stein 阅读(16) 评论(1) 推荐(1) 编辑
摘要: 二分 #include <iostream> #include <stdio.h> #include <algorithm> #include <cstring> #define For(i, j, n) for(int i = j ; i <= n ; ++i) using namespace s 阅读全文
posted @ 2023-12-22 17:41 Gold_stein 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 根据裴蜀定理可得INF的情况是所有数的最大公约数非1 而我们的完全背包的上限是多少呢? 设置为Σai即可,因为把每一个ai用上之后的集合,和ai可以重复使用的集合,只差了整数倍个ai,因此可达性是完全一致的,这里N<=100,ai<=100,所以我们把这个背包的上限设置为10000. #includ 阅读全文
posted @ 2023-12-22 17:18 Gold_stein 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 基本可以确定这道题是一个dp,我首先想到的思路是,根据回文序列对称的特性,把这个原序列分成前后两半来做,但是每次对序列进行添加操作,都会导致中心点的移动,导致这种做法非常麻烦,因此需要转换思路: 不妨直接把整个序列颠倒过来,那些本身是回文串的部分,颠倒之后还是回文串,而剩下的那些部分,为了把它们变成 阅读全文
posted @ 2023-12-22 16:58 Gold_stein 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 前置知识: 置换环,最小交换次数 https://blog.csdn.net/yunxiaoqinghe/article/details/113153795?ops_request_misc=&request_id=&biz_id=102&utm_term=%E6%9C%80%E5%B0%91%E4 阅读全文
posted @ 2023-12-19 17:45 Gold_stein 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 注意,最后统计答案的时候,要把f[1]也考虑进去,也可以直接把f[0]设为1,就能保证正确性了。 #include <iostream> #include <stdio.h> #include <algorithm> #include <cstring> #define For(i, j, n) f 阅读全文
posted @ 2023-12-17 02:07 Gold_stein 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 四个数,当前三个确定时最后一个可以通过前三个所出来,所以只需要枚举前三个 #include <iostream> #include <stdio.h> #include <algorithm> #include <cmath> #include <cstring> #define For(i, j, 阅读全文
posted @ 2023-12-13 00:48 Gold_stein 阅读(21) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <stdio.h> #include <algorithm> #include <cstring> #define For(i, j, n) for(int i = j ; i <= n ; ++i) using namespace std; 阅读全文
posted @ 2023-12-13 00:18 Gold_stein 阅读(15) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页