洛谷
fftx_00
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【洛谷】P1522 [USACO2.4]牛的旅行 Cow Tours
#include <bits/stdc++.h>using namespace std;#define maxn 160#define inf 1e20struct node{ int x,y;};double calS(const node &n1,const node &n2){ return sqrt((n1.x-n2.x)*(n1.x-n2.x)+(n1.y-n2.y)*(n1.y-n2.y));}int nv;int G[maxn.原创 2022-02-08 16:34:36 · 541 阅读 · 0 评论 -
【洛谷】P1462 通往奥格瑞玛的道路
#include <bits/stdc++.h>using namespace std;struct node{ long long v; long long c;//c:血量->边权 friend bool operator < (const node &n1,const node &n2){//小根堆 return n1.c>n2.c; }};#define maxn 10010long lon.原创 2022-02-07 20:04:14 · 499 阅读 · 0 评论 -
【洛谷】P1163 银行贷款
#include <bits/stdc++.h>using namespace std;int y,per,m;double f(double w){ double ans=0,v=1; for(int i=1;i<=m;i++){ v*=(1+w); ans+=(per/v); } return ans;}int main(){ scanf("%d %d %d",&y,&per,&am.原创 2022-02-07 17:30:53 · 1064 阅读 · 0 评论 -
【洛谷】P1102 A-B 数对
#include <bits/stdc++.h>using namespace std;#define maxn 200010int a[maxn];int main(){ int n,c; long long ans=0;//最坏情况ans=n^n=4*10^10 -> long long scanf("%d %d",&n,&c); for(int i=0;i<n;i++){ scanf("%d",&a.原创 2022-02-07 16:38:55 · 365 阅读 · 0 评论 -
【洛谷】P1144 最短路计数
因为无向无权,实际上最短路径长度=该点在bfs搜索树的深度dfs似乎没法解决自环,会一直不断循环当然用Dijkstra做也可以#include <bits/stdc++.h>using namespace std;struct d_node{ int v,w; friend bool operator < (const d_node &d1,const d_node &d2){ return d1.w>d2.w;.原创 2022-02-06 18:55:19 · 881 阅读 · 0 评论 -
【洛谷】P1629 邮递员送信
单起点最短路->一对多:Dijkstra算法单终点最短路->多对一:反着建图+Dijstra算法#include <bits/stdc++.h>using namespace std;struct node{ int v,w; friend bool operator < (const node &n1,const node &n2){ return n1.w>n2.w; }};int nv.原创 2022-02-05 21:11:33 · 288 阅读 · 0 评论 -
【洛谷】P3916 图的遍历
//反向建边+nv次dfs【从大到小】#include <bits/stdc++.h>using namespace std;int nv,ne;vector<int> v[100010];int ans[100010];void dfs(int root,int index){ if(ans[root]) return;//被访问过 ans[root]=index; for(int i=0;i<v[root].size();i++).原创 2022-02-04 20:22:18 · 450 阅读 · 0 评论
分享