随笔分类 -  Algorithm

摘要:LightOJ1027 A Dangerous Maze 思路:简单概率。 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int maxn = 105; int gcd(int x, 阅读全文
posted @ 2021-08-07 09:23 Nanachi 阅读(56) 评论(0) 推荐(0)
摘要:POJ2955 Brackets #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int maxn = 105; char s[maxn]; int dp[maxn][maxn]; in 阅读全文
posted @ 2021-07-24 21:42 Nanachi 阅读(34) 评论(0) 推荐(0)
摘要:HDU2222 Keywords Search 思路:AC自动机模板。 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<queue> using namespace std; con 阅读全文
posted @ 2021-05-14 20:54 Nanachi 阅读(76) 评论(0) 推荐(0)
摘要:CodeForces55D Beautiful numbers 思路:经典题。考虑1至9的最小公倍数,还有前缀数中出现过的数能否整除。 #include<iostream> #include<vector> #include<cstring> using namespace std; typedef 阅读全文
posted @ 2021-05-10 23:39 Nanachi 阅读(66) 评论(0) 推荐(0)
摘要:POJ2318 TOYS 思路:二分。 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int maxn = 5005; int n, m, x1, y1, x2, y2; int bo 阅读全文
posted @ 2021-05-03 09:09 Nanachi 阅读(110) 评论(0) 推荐(0)
摘要:HDU1711 Number Sequence 思路:kmp模板。 #include<iostream> #include<cstring> #include<algorithm> #include<cstdio> using namespace std; const int maxm = 1e4 阅读全文
posted @ 2021-04-17 20:51 Nanachi 阅读(78) 评论(0) 推荐(0)
摘要:先跳过几章,换换口味。 HDU1024 Max Sum Plus Plus 思路:经典DP题。 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int maxn = 1e6 + 5; i 阅读全文
posted @ 2021-03-10 21:22 Nanachi 阅读(118) 评论(0) 推荐(0)
摘要:终于到专题七了。 HDU1166 敌兵布阵 思路:线段树模板题。 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; const 阅读全文
posted @ 2021-02-22 09:52 Nanachi 阅读(95) 评论(0) 推荐(0)
摘要:不知不觉已经刷到专题六了,但感觉进度还是有点慢了(*  ̄︿ ̄) POJ1251 Jungle Roads 思路:模板题。 #include <iostream> #include <algorithm> #include <stdio.h> using namespace std; const in 阅读全文
posted @ 2021-02-05 11:18 Nanachi 阅读(49) 评论(0) 推荐(0)
摘要:不想写实验,不想改paper,写点代码吧(;´д`)ゞ POJ2236 Wireless Network 思路:简单并查集。 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int IN 阅读全文
posted @ 2021-02-01 11:57 Nanachi 阅读(61) 评论(0) 推荐(0)
摘要:POJ2387 Til the Cows Come Home 思路:dijkstra搜索。 #include<iostream> #include<cstring> #include<queue> using namespace std; const int maxn = 1005; const i 阅读全文
posted @ 2021-01-29 11:12 Nanachi 阅读(38) 评论(0) 推荐(0)
摘要:前:上个专题有点麻烦,暂时不想写了。 Luogu P4929 思路:这题不是kuangbin专题里的,但是一道裸dancing links题,算法模板来自OI wiki。Dancing links在recover和remove时的遍历方向需要注意,虽然模板里的方向是相反的,但我测试发现方向可以变化, 阅读全文
posted @ 2021-01-06 15:42 Nanachi 阅读(83) 评论(0) 推荐(0)
摘要:前:这节以后,我尽可能的增加代码的可读性,为此将牺牲一定程度的简洁。 HDU1043 Eight 思路:cantor展开。 #include <iostream> #include <cstring> #include <string> #include <queue> #include <vect 阅读全文
posted @ 2020-11-01 09:31 Nanachi 阅读(96) 评论(0) 推荐(0)
摘要:前:kuangbin的题目比较多,为了简化篇幅,对于一些常规的题目,就不再多写题干了,还望周知。 POJ 1321 棋盘问题 思路:dfs #include <iostream> using namespace std; const int maxn = 15; int n, k; char mm[ 阅读全文
posted @ 2020-10-26 11:15 Nanachi 阅读(171) 评论(0) 推荐(0)