11 条题解

  • 3

    #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;
    }

    //不适合高精度:)

  • 1

    #include<iostream>
    using namespace std;

    int main()
    {
    int a,b;
    cin>>a>>b;
    cout<<a+b;
    return 0;
    }

  • 0
    @ 2024-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;
    }

  • 0
    @ 2024-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;
    }
    
  • -1

    #include <iostream>
    using namespace std;
    int main()
    {
    int x,y;
    cin>>x>>y;
    cout<<x+y;
    return 0;
    }

  • -1
    @ 2021-11-17 17:30:40

    #include<iostream>
    using namespace std;
    int main()
    {
    int x,y;
    cin>>x>>y;
    cout<<x+y<<endl;
    return 0;
    }

  • -1

    #include<iostream>
    using namespace std;
    int main()
    {
    int x,y;
    cin>>x>>y;
    cout<<x+y<<endl;
    return 0;
    }
    //nice

  • -2
    @ 2021-11-21 21:14:33

    #include <iostream>
    using namespace std;
    int main()
    {
    int x,y;
    cin>>x>>y;
    cout<<x+y;
    return 0;
    }

  • -3

    #include<iostream>
    using namespace std;
    int main()
    {
    int x,y;
    cin>>x>>y;
    cout<<x+y<<endl;

    return 0;

    }

  • -3
    @ 2021-11-15 09:56:06

    #include<iostream>
    using namespace std;
    int main()
    {
    int x,y;
    cin>>x>>y;
    cout<<x+y;
    return 0;
    }
    //简单

  • -4

    #include<iostream>
    using namespace std;
    int main()
    {
    int a,b;
    cin>>a>>b;
    cout<<a+b;
    return 0;
    }

  • 1

信息

ID
1207
难度
8
分类
(无)
标签
递交数
3940
已通过
337
通过率
9%
上传者