
杭电题
岁忧
(目前更新LeetCode每日一题ing)记录一些平时做的题目,写些小小的心得。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU 1269 迷宫城堡(Kosaraju算法)
HDU 1269 迷宫城堡 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1269 #include <iostream> #include<algorithm> #include<cstdio> #include<cstring> #include<vector> using namespace std; const int N=10010; vector<int > q[N],p[N];原创 2021-05-19 16:52:14 · 196 阅读 · 0 评论 -
(hash) Number Sequence
Number Sequence #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; typedef long long LL; LL n,m; LL a[1000010],sumb; LL p[1000010]; int main(){ int tx; cin>>tx; while(t原创 2021-05-03 22:42:51 · 113 阅读 · 0 评论 -
(二分+hash)Obtain The String
Obtain The String #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<vector> using namespace std; const int N=1e5+10; char a[N],b[N]; vector<int> p[50]; int erfen(int u,int t){ int l原创 2021-05-03 22:39:57 · 93 阅读 · 0 评论 -
(hash+string)HDU 4821 String
HDU 4821 String 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=4821 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<map> using namespace std; const int N=1e5+10; typedef unsigned long long LL原创 2021-05-03 22:28:13 · 128 阅读 · 0 评论 -
(hash+string)HDU 4300 Clairewd’s message
杭电题 HUD Clairewd’s message 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=4300 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; typedef long long LL; const int N=1e5+10; LL p[N]; char a[原创 2021-05-03 22:25:17 · 98 阅读 · 0 评论 -
(dp)杭电题 2571 命运
命运 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=2571 (x,y*k),这个讨论时要注意一下,易错点 #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int M = -2000010; int a[25][1010],dp[25][1010]; int n, m; bool fw(int x, int原创 2021-03-24 22:38:46 · 121 阅读 · 0 评论 -
(大数)杭电题 2100 Lovekey
杭电题 2100 Lovekey 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=2100 string方式: #include<iostream> #include<cstring> using namespace std; int main() { string a, b; while(cin >> a >> b) { int lena = a.size(); int lenb = b.size()原创 2021-03-24 21:50:26 · 135 阅读 · 0 评论 -
(错排)杭电题 2068 RPG的错排
RPG的错排 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=2068 思路:就是错排,从n个女生里抽出m(m<(n>>1))个排在错误位置上的女生. #include<iostream> using namespace std; typedef long long ll; ll c[30] = {0,0,1};//排错 ll dg(int n, int m) { ll temp = 1; for (int i = 0; i &l原创 2021-03-24 21:22:14 · 162 阅读 · 0 评论 -
(dp,挺好的题)杭电 3602题2012
杭电 3602题2012 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=3602 #include<iostream> #include<cstring> #include<algorithm> #define INF 0x3f3f3f3f using namespace std; int n, m, k; int dp[10010];//dp[i],到money=i时,所需要的位置。10^7复杂度 int dd(int a,原创 2021-03-23 23:09:35 · 169 阅读 · 0 评论 -
Lawrence of Arabia
Lawrence of Arabia 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=3102 #include<iostream> #include<algorithm> #include<cstring> using namespace std; int n, m; int a[1010]; int b[1010][1010],s[1010],dp[1010]; int main() { while (cin >&g原创 2021-01-25 20:00:29 · 132 阅读 · 0 评论 -
Oil Deposits
Oil Deposits 添加链接描述http://acm.hdu.edu.cn/showproblem.php?pid=1241 #include<iostream> #include<cstring> using namespace std; char a[110][110]; bool vis[110][110]; int fx[8][2] = { {0,1},{0,-1},{1,0},{-1,0},{-1,-1},{-1,1},{1,1},{1,-1} }; int ans;原创 2021-01-25 17:17:12 · 111 阅读 · 0 评论 -
Kill the monster
Kill the monster 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=2616 #include<iostream> #include<algorithm> #include<cstring> using namespace std; typedef struct Node { int x; int y; }node; node a[10]; bool vis[10]; //bool flag; int n,原创 2021-01-25 16:23:00 · 198 阅读 · 0 评论 -
Tempter of the Bone
Tempter of the Bone 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1010 注意奇偶剪枝,否则会超时 #include<iostream> #include<cstring> #include<cmath> using namespace std; char a[10][10]; bool vis[10][10]; int fx[4][2] = { {1,0},{-1,0},{0,1},{0,-1} };原创 2021-01-25 15:55:08 · 76 阅读 · 0 评论 -
杭电OJ2602Bone Collector
杭电OJ2602Bone Collector 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=2602 方案一:动态规划DP,至下而上,二维数组 //动态规划DP,至下而上,二维数组 #include<iostream> #include<algorithm> using namespace std; typedef struct Node { int value; int volume; }node; node a[1010]; i原创 2021-01-14 20:29:33 · 162 阅读 · 0 评论 -
(考互质)杭电OJ2104 hide handkerchief
杭电OJ2104 hide handkerchief 考互质 Problem Description The Children’s Day has passed for some days .Has you remembered something happened at your childhood? I remembered I often played a game called hide handkerchief with my friends. Now I introduce the game原创 2020-12-24 20:18:09 · 200 阅读 · 1 评论 -
杭电2066 一个人的旅行
杭电2066 一个人的旅行 题目http://acm.hdu.edu.cn/showproblem.php?pid=2066 方法1:Dijkstra #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define mm 1010 using namespace std; int T, S, D,n,minn; int r[mm][mm],mark[mm];原创 2020-12-02 23:51:49 · 216 阅读 · 0 评论 -
杭电OJ 1003Max Sum
杭电OJ 1003Max Sum 链接http://acm.hdu.edu.cn/showproblem.php?pid=1003 思路:其实就是比较sum+新的一个a[i]是否小于a[i],小于则从i,开始计数,不小于则包括i; #include<iostream> #include<cstdio> #include<cstring> using namespace std; typedef long long ll; int a[100010]; int st, e原创 2020-12-02 12:28:02 · 172 阅读 · 0 评论 -
杭电OJ 2065“红色病毒“问题
杭电OJ 2065"红色病毒"问题 链接:http://acm.hdu.edu.cn/showproblem.php?pid=2065 //快速幂+数学 #include<iostream> #include<cstdio> using namespace std; int ksm(long long base, long long power) {//快速幂 int result = 1; while (power) { if (power &原创 2020-12-01 19:26:10 · 434 阅读 · 0 评论 -
杭电OJ2200 Eddy‘s AC难题
Problem Description Eddy是个ACMer,他不仅喜欢做ACM题,而且对于Ranklist中每个人的ac数量也有一定的研究,他在无聊时经常在纸上把Ranklist上每个人的ac题目的数量摘录下来,然后从中选择一部分人(或者全部)按照ac的数量分成两组进行比较,他想使第一组中的最小ac数大于第二组中的最大ac数,但是这样的情况会有很多,聪明的你知道这样的情况有多少种吗? 特别说明:为了问题的简化,我们这里假设摘录下的人数为n人,而且每个人ac的数量不会相等,最后结果在64位整数范围内.原创 2020-11-17 14:43:51 · 151 阅读 · 0 评论 -
杭电OJ2063过山车
杭电OJ2063过山车 Problem Description RPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,PrincessSnow愿意和水域浪子或伪酷儿做partner。考虑到经费问题,boss刘决定只让找到partne转载 2020-11-17 12:19:58 · 279 阅读 · 0 评论