上一页 1 2 3 4 5 6 ··· 10 下一页
摘要: #include <bits/stdc++.h> using namespace std; const int N= 205; int w[N][N]; int dp[N][2]; int n,m; int main(){ while(scanf("%d%d",&n,&m)!=EOF){ memse 阅读全文
posted @ 2026-03-15 20:04 peter_shen 阅读(7) 评论(0) 推荐(0)
摘要: 使用了set set具有互异性,multiset没有 set和ordered_map都是使用erase和insert,find删插查。 使用clear清空 #include <bits/stdc++.h> using namespace std; typedef long long ll; int 阅读全文
posted @ 2026-03-15 20:04 peter_shen 阅读(7) 评论(0) 推荐(0)
摘要: 两种筛法 #include <bits/stdc++.h> using namespace std; const int N=1e6+10; bool vis[N]; int prime[N]; int n; int k=0; //void sieve(){ // vis[1]=1; // for( 阅读全文
posted @ 2026-03-15 12:18 peter_shen 阅读(10) 评论(0) 推荐(0)
摘要: 使用中位数定理 先要排序,但对于X数组,我先排一次序,然后对X数组做减法,相当于对等式做了变形 还需要再排一次序,才能对X数组使用中位数定理 #include <bits/stdc++.h> using namespace std; int n; const int N=10010; int x[N 阅读全文
posted @ 2026-03-15 11:28 peter_shen 阅读(9) 评论(0) 推荐(0)
摘要: 多个数的最小公倍数以及辗转相除法求最大公约数 #include <bits/stdc++.h> using namespace std; int t; int num[12]; int gcd(int a,int b){ while(b!=0){ int temp = a%b; a=b; b=tem 阅读全文
posted @ 2026-03-14 22:41 peter_shen 阅读(11) 评论(0) 推荐(0)
摘要: 使用同余定理 #include <bits/stdc++.h> using namespace std; typedef long long ll; char n[10010]; ll p; int main(){ while(scanf("%s%d",n+1,&p)!=EOF){ //cout<< 阅读全文
posted @ 2026-03-14 22:24 peter_shen 阅读(8) 评论(0) 推荐(0)
摘要: 没有想到倒着贪心 注意我这里其实可以没等输入完就可以判断会不会无解 但是这样会导致我没有吃完本组输入样例,以至于我输出超限50% #include <bits/stdc++.h> using namespace std; int n,k; const int N=5010; int dist[N]; 阅读全文
posted @ 2026-03-14 19:45 peter_shen 阅读(8) 评论(0) 推荐(0)
摘要: 很简单的贪心呢,就是double赋值给int,是截断小数部分 #include <bits/stdc++.h> using namespace std; int n; double t; struct node{ double z; double up; bool operator<(const n 阅读全文
posted @ 2026-03-14 16:09 peter_shen 阅读(4) 评论(0) 推荐(0)
摘要: 建议重做 这题用了hash,我已经基本忘掉了, #include <bits/stdc++.h> using namespace std; const int N=1010; char s[N]; int main(){ while(scanf("%s",s+1)!=EOF){ unordered_ 阅读全文
posted @ 2026-03-14 15:38 peter_shen 阅读(11) 评论(0) 推荐(0)
摘要: dij memset(dist,0x3f,sizeof(dist)); 0x3f用于两个int相加不溢出,如果不怕遇到这种特殊情况,可以改成0x7f #include <bits/stdc++.h> using namespace std; int n,m,s,t,a; const int N=10 阅读全文
posted @ 2026-03-14 14:49 peter_shen 阅读(10) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 10 下一页