摘要: P1226 【模板】快速幂 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) #include<iostream> #include<cstring> using namespace std; typedef long long ll; ll a,b,p; ll quickpow(l 阅读全文
posted @ 2024-02-11 12:43 ACCbulb 阅读(17) 评论(0) 推荐(0)
摘要: 2299 -- Ultra-QuickSort (poj.org) #include<iostream>//归并排序 #include<cstring> using namespace std; typedef long long ll; const int N=500010; int a[N],t 阅读全文
posted @ 2024-02-11 11:54 ACCbulb 阅读(7) 评论(0) 推荐(0)
摘要: Problem - 2037 (hdu.edu.cn) #include<iostream>/*活动安排的贪心问题*/ #include<algorithm> using namespace std; const int N=110; int n; struct node{ int begin,en 阅读全文
posted @ 2024-02-10 17:58 ACCbulb 阅读(33) 评论(0) 推荐(0)
摘要: Problem - 2553 (hdu.edu.cn)(N <= 10) #include<iostream> #include<cstring> using namespace std; int n,tot=0; int col[12]; bool check(int c,int r){ for( 阅读全文
posted @ 2024-02-05 13:46 ACCbulb 阅读(7) 评论(0) 推荐(0)
摘要: 吃完晚饭,啃着tomato来poj上提交,结果不支持unordered_map,吐血啦,看来还是要用BFS+康托展开,还想再写一篇双向BFS的,对这道题算是圆满了*_*,但是要用G++提交,C++会报错我也不知道为嘛 #include<iostream> #include<cstring> #inc 阅读全文
posted @ 2024-02-04 21:21 ACCbulb 阅读(8) 评论(0) 推荐(0)
摘要: 1077 -- Eight (poj.org) 由结论可以知道逆序对为奇数的时候无解,f为估值函数,计算曼哈顿距离。 想用康托展开写,但多状态数码问题用数组存储状态不够,有TLE的风险,还是A*吧! 吃一个tomato宣告今日...不知道结不结束 #include<iostream> #includ 阅读全文
posted @ 2024-02-04 16:23 ACCbulb 阅读(13) 评论(0) 推荐(0)
摘要: Problem - 1312 (hdu.edu.cn) BFS模板题 #include<iostream> #include<queue> using namespace std; typedef long long ll; const int INF=0x3f3f3f3f; int wx,hy,n 阅读全文
posted @ 2024-02-03 18:07 ACCbulb 阅读(20) 评论(0) 推荐(0)
摘要: Problem - 4460 (hdu.edu.cn) 写完提交答案错了,后面发现vis初始化的地方错了,以前BFS都只调用一次,看来我中毒太深。这个题更能体现BFS的特性,增加dis数组记录距离。 #include<iostream> #include<queue> #include<cstrin 阅读全文
posted @ 2024-02-03 18:00 ACCbulb 阅读(21) 评论(0) 推荐(0)
摘要: Problem - 1240 (hdu.edu.cn) 三维的BFS,存在一个坐标点的变换,即输入的是 (y , z , x),进行转换即可 #include<iostream> #include<queue> #include<cstring> using namespace std; int n 阅读全文
posted @ 2024-02-03 16:22 ACCbulb 阅读(22) 评论(0) 推荐(0)
摘要: 3414 -- Pots (poj.org) 这道题需要输出最后结果的执行过程,可以通过结构体,在结构体中定义一个数组s,s中存储了每一步的执行过程,实现了回溯。并且在运行中可以适当剪枝,减少枚举次数。 #include<iostream> #include<queue> #include<cstr 阅读全文
posted @ 2024-02-03 14:35 ACCbulb 阅读(25) 评论(0) 推荐(0)