10 2023 档案
发表于 2023-10-31 17:43阅读次数:6评论次数:0
摘要:P1825 Corn Maze S 无脑深搜,然后卡死在了37pts。 #include<iostream> #include<algorithm> #include<cstdio> using namespace std; struct coord { int x, y; }; int walk[
阅读全文 »
发表于 2023-10-30 09:43阅读次数:15评论次数:0
摘要:P1162 填涂颜色 大概思路,暴搜所有 点,搜到就填色,然后搜色块的时候一旦碰边就打标记,回溯之后看标记决定标 还是标 。 思路是理论可行,但是代码容易出问题。 一开始 的代码 #include<iostream> #include<algorithm> #
阅读全文 »
发表于 2023-10-29 11:14阅读次数:19评论次数:0
摘要:P2895 [USACO08FEB] Meteor Shower S 语言问题引发的惨案 题目本身不难,简单的BFS,但是写出来明明思路感觉没有问题,却不是答案错就是爆队列。 #include <iostream> #include <algorithm> #include <cstdio> #in
阅读全文 »
发表于 2023-10-26 16:11阅读次数:6评论次数:0
摘要:P1182 数列分段 Section II 再一次对位单杀18年的我 #include<cctype> #include<cstdio> #include<algorithm> using std::sort; int n,a[100010],QZ_sum[100
阅读全文 »
发表于 2023-10-25 17:54阅读次数:17评论次数:0
摘要:二分答案 使用条件(最大的最小,最小的最大) 命题可以被归纳为找到使得某命题 成立(或不成立)的最大(或最小)的 。 把 看作一个值为真或假的函数,那么它一定在某个分界线的一侧全为真,另一侧全为假。 可以找到一个复杂度优秀的算法来检验 的真假。 好理
阅读全文 »
发表于 2023-10-24 20:36阅读次数:9评论次数:0
摘要:while (l <= r) { mid = l + (r - l) >> 1; ...... } 这样是错误的! 由于>>的优先级问题,应用如下格式。 while (l <= r) { mid = l +( (r - l) >> 1); ...... }
阅读全文 »
发表于 2023-10-23 17:22阅读次数:17评论次数:0
摘要:一开始贪心思路不对且根本没考虑重复,无脑sort后直接排组玄学了70pts。 #include <iostream> #include <algorithm> using namespace std; int n; int cnt, ans = 0x7fffffff; int a[100010];
阅读全文 »
发表于 2023-10-23 16:49阅读次数:145评论次数:0
摘要:iterator是通用的遍历容器的方式 通用模板 anySet <a...> as; anySet <a...>::iterator it = as.begin(); for (; it != as.end(); it++) { cout <<(*it);//即迭代器it指向的元素 } 四种迭代器
阅读全文 »
发表于 2023-10-22 22:39阅读次数:11评论次数:0
摘要:P1106删数问题 对2018年的我一次完美的对位单杀 2018 44pts Code #include<cstdio> #include<iostream> #include<algorithm> using std::cin; using std::cout; using std::sort;
阅读全文 »
发表于 2023-10-10 12:42阅读次数:23评论次数:0
摘要:昨天晚上看了题目没思路。 早上上课回来之后想着就直接根据题目搞一个左脑一个右脑,然后两边分别加时间取最大暴搜,结果T了九个,这是代码。 #include <iostream> using namespace std; int tAns, ans; int s[5], array[30]; bool
阅读全文 »
发表于 2023-10-07 19:31阅读次数:3评论次数:0
摘要:对比例的计算在整形中的应用不熟练。 要算A:B = X : Y; 最好的方法不是 B = A * (Y/X); 而是 B = A * Y / X;
阅读全文 »
发表于 2023-10-07 18:06阅读次数:3评论次数:0
摘要:康复训练的第一道搜索 调了一个小时,这是原来的代码 #include <iostream> #include <cstring> using namespace std; int n; int ans[500][11], count; void dfs(int step, int sum) { if
阅读全文 »
发表于 2023-10-06 10:00阅读次数:5评论次数:0
摘要:传址调用 void swap(int* p1, int* p2) { int temp = *p1; *p1 = *p2; *p2 = temp; } int main() { swap(&x, &y); } 引用调用 void swap(int& p1, int& p2) { int temp =
阅读全文 »
发表于 2023-10-06 09:55阅读次数:12评论次数:0
摘要:做不出来根本原因在于对快速排序理解不彻底 快排代码 int randint(int l, int r){ // 生成在 [l, r] 之间的随机数 return rand() % (r - l + 1) + l; } void qsort(int l, int r){ // l 为左端点,r 为右端
阅读全文 »