11 条题解
-
312107张凌睿 (202112107张凌睿) LV 10 @ 2022-07-16 11:43:18
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cctype>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#define INF 2147483647
#define LL long long
#define ULL unsigned long long
#define MAXN 10005
using namespace std;
inline int read()
{
char ch=getchar();
int x=0,f=1;
while(!isdigit(ch))
{
if(ch=='-') f=-1;
ch=getchar();
}
while(isdigit(ch))
{
x=x*10+ch-'0';
ch=getchar();
}
return x*f;
}
struct Edge{
int v,w;
Edge(int v=0,int w=0):v(v),w(w){}};
struct Node{
int id;
LL d;
Node(int id=0,LL d=0):id(id),d(d){}
bool operator <(const Node& n1)const{
return d>n1.d;
}
};
vector<Edge> adj[500005];
priority_queue<Node> q;
int n,m,s;
LL d[MAXN];
bool vis[MAXN];
void dijkstra(int st)
{
for(int i=1;i<=n;i++) d[i]=INF;
d[st]=0;
int u=0,v=0,w=0;
q.push(Node(st,0));
while(!q.empty())
{
u=q.top().id;
q.pop();
if(vis[u]) continue;
vis[u]=1;
int len=adj[u].size();
for(int i=0;i<len;i++)
{
v=adj[u][i].v;
w=adj[u][i].w;
if(d[u]+w<d[v])
{
d[v]=d[u]+w;
q.push(Node(v,d[v]));
}
}
}
}
int aa,bb;
int main()
{
aa=read();
bb=read();
n=3;
adj[1].push_back(Edge(2,aa));
adj[2].push_back(Edge(3,bb));
dijkstra(1);
printf("%lld",d[3]);
return 0;
}//不适合高精度:)
-
12024-10-19 09:26:11@
#include<iostream>
using namespace std;int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
} -
02024-09-07 08:15:31@
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
} -
02024-06-15 12:47:59@
#include<iostream> using namespace std; int main(){ ios::sync_with_stdio(false); int a, b; cin >> a >> b; cout << a+b; return 0; }
-
-12021-12-01 17:09:09@
#include <iostream>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
cout<<x+y;
return 0;
} -
-12021-11-17 17:30:40@
#include<iostream>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
cout<<x+y<<endl;
return 0;
} -
-12021-11-06 16:12:49@
#include<iostream>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
cout<<x+y<<endl;
return 0;
}
//nice -
-22021-11-21 21:14:33@
#include <iostream>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
cout<<x+y;
return 0;
} -
-32021-11-20 12:21:55@
#include<iostream>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
cout<<x+y<<endl;
return 0;}
-
-32021-11-15 09:56:06@
#include<iostream>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
cout<<x+y;
return 0;
}
//简单 -
-42021-12-31 16:22:23@
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
}
- 1
信息
- ID
- 1207
- 难度
- 8
- 分类
- (无)
- 标签
- 递交数
- 3943
- 已通过
- 339
- 通过率
- 9%
- 上传者