摘要: #include <bits/stdc++.h> using namespace std; const int N=1e6+10; int num[N]; int n; int main(){ while(scanf("%d",&n)!=EOF){ for(int i=1;i<=n;i++){ sc 阅读全文
posted @ 2026-03-26 17:06 peter_shen 阅读(1) 评论(0) 推荐(0)
摘要: 博弈论dp dp为1代表先手赢,否则输 #include <bits/stdc++.h> using namespace std; int x,y; int dp[1010][1010]; int fun(int x,int y){ if(dp[x][y]!=-1){ //cout<<x<<" "< 阅读全文
posted @ 2026-03-25 13:23 peter_shen 阅读(4) 评论(0) 推荐(0)
摘要: 记忆化搜索,dp自上而下 #include<bits/stdc++.h> using namespace std; int m,n; const int N=1010; int num[N]; int dp[N][N]; int fun(int l,int r){ //cout<<l<<" "<<r 阅读全文
posted @ 2026-03-25 13:21 peter_shen 阅读(3) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; const int N=1e5+10; int t; int dp[N]; int main(){ scanf("%d",&t); while(t--){ int n; scanf("%d",&n); vec 阅读全文
posted @ 2026-03-21 13:47 peter_shen 阅读(4) 评论(0) 推荐(0)
摘要: lower_bound的使用,需要三个参数 并且是在有等于的时候返回等于的迭代器 #include <bits/stdc++.h> using namespace std; int main(){ int n,m; scanf("%d%d",&n,&m); vector<int> vec; // p 阅读全文
posted @ 2026-03-20 22:33 peter_shen 阅读(3) 评论(0) 推荐(0)
摘要: dp使用longlong就会数组越界 #include <bits/stdc++.h> using namespace std; int n,m,q; const int N=5002; typedef long long ll; ll p=1000000007; ll dp[N][N]; int 阅读全文
posted @ 2026-03-19 22:39 peter_shen 阅读(1) 评论(0) 推荐(0)
摘要: map使用迭代器访问的话就是 it->first,it->second 然后map注意键不重复 #include <bits/stdc++.h> using namespace std; int n; const int N=1e5+10; long long num[N][2]; struct n 阅读全文
posted @ 2026-03-19 21:42 peter_shen 阅读(3) 评论(0) 推荐(0)
摘要: 多源BFS,下面这个代码会超时,我得把node节点去掉,vis使用时间戳 #include <bits/stdc++.h> using namespace std; const int N=1e5+10; const int K=105; int n,m,k,s; int num[N]; vecto 阅读全文
posted @ 2026-03-17 17:00 peter_shen 阅读(2) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> #include <windows.h> using namespace std; char str[30]; stack<char> sta; int main(){ while(scanf("%s",str+1)!=EOF){ int i=1; f 阅读全文
posted @ 2026-03-17 11:29 peter_shen 阅读(2) 评论(0) 推荐(0)
摘要: 到同一个点的同一个方向必须转向次数越来越小 #include <bits/stdc++.h> using namespace std; char mp[105][105]; int vis[105][105][4]; int dir[4][2]={{-1,0},{0,1},{1,0},{0,-1}} 阅读全文
posted @ 2026-03-16 15:54 peter_shen 阅读(2) 评论(0) 推荐(0)