8 条题解

  • 2
    @ 2025-6-7 16:02:16

    先写头文件,在写代码输出"Hello World"。

  • 2
    @ 2025-6-7 16:01:20

    先写头文件,在写代码输出"Hello World"。

  • 2
    @ 2025-6-7 16:00:52

    #include using namespace std; int main(){ cout<<"Hello World"; return 0; }

    • 2
      @ 2025-6-7 15:57:41

      #include using namespace std; int main(){ cout<<"Hello World"; return 0; }

    • 1
      @ 2025-7-17 8:39:06

      666

      • 1
        @ 2025-7-16 21:43:33

        #include<bits/stdc++.h> using namespace std; int main(){ cout<<"Hello World"; return 0; }

        • -1
          @ 2025-9-4 18:36:58

          #include <bits/stdc++.h> using namespace std; vector<vector > adj; vector get_path(int s, int t, int n) { vector parent(n + 1, 0); vector visited(n + 1, false); queue q; q.push(s); visited[s] = true; parent[s] = -1; bool found = false; while (!q.empty() && !found) { int u = q.front(); q.pop(); for (int v : adj[u]) { if (!visited[v]) { visited[v] = true; parent[v] = u; q.push(v); if (v == t) { found = true; break; } } } } vector path; int curr = t; while (curr != -1) { path.push_back(curr); curr = parent[curr]; } reverse(path.begin(), path.end()); return path; }

          int main() { int n, a; cin >> n >> a; adj.resize(n + 1); for (int i = 0; i < n - 1; ++i) { int x, y; cin >> x >> y; adj[x].push_back(y); adj[y].push_back(x); } vector<pair<int, int>> good_pairs; for (int i = 0; i < a; ++i) { int u, v; cin >> u >> v; good_pairs.emplace_back(u, v); } int bu, bv; cin >> bu >> bv; vector B = get_path(bu, bv, n); vector good_mark(n + 1, false); for (auto& p : good_pairs) { int u = p.first, v = p.second; vector path = get_path(u, v, n); for (int node : path) { good_mark[node] = true; } } int ans = 0; for (int node : B) { if (!good_mark[node]) { ans++; } } cout << ans << endl; return 0; }

          • -2
            @ 2025-9-10 18:16:39

            一群SB

            • 1

            信息

            ID
            1
            时间
            1000ms
            内存
            256MiB
            难度
            6
            标签
            递交数
            35
            已通过
            11
            上传者