World Robot Contest2025-2026Algorithm Application ThemeJunior Highwrc.hao.work
WRC
Contest Archive / Structured Dossiers青少年算法应用训练档案馆

把训练题、知识点、执行证据和最终解题档案统一归档成可直接浏览的竞赛资料库。

Archive30 Cases

四大文化赛道完整展开

AccessHTTPS

完整题面 / 题解 / 运行证据

No Rounded CornersTailwind FirstDossier Ready
03-execution/run-002/source-snapshot/main.cpp

main.cpp

站内文件视图直接读取仓库内容,Markdown 使用文档排版渲染,其余文本文件保持原始排版,方便校对训练证据链。

文件类型.cpp

10-cases/s3-jh-04-eco-model/03-execution/run-002/source-snapshot/main.cpp

#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

string level(double score) {
    if (score >= 85.0) {
        return "A";
    }
    if (score >= 70.0) {
        return "B";
    }
    return "C";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    if (!(cin >> n)) {
        return 0;
    }
    double total = 0.0;
    string best_name;
    double best_score = -1e100;
    vector<string> levels;
    for (int i = 0; i < n; ++i) {
        string name;
        int water, trade, vegetation;
        cin >> name >> water >> trade >> vegetation;
        double score = water * 0.4 + trade * 0.35 + vegetation * 0.25;
        total += score;
        levels.push_back(name + ":" + level(score));
        if (score > best_score || (fabs(score - best_score) < 1e-9 && name < best_name)) {
            best_name = name;
            best_score = score;
        }
    }
    cout << fixed << setprecision(2);
    cout << "best=" << best_name << ' ' << best_score << "\n";
    cout << "levels=";
    for (size_t i = 0; i < levels.size(); ++i) {
        if (i) {
            cout << ',';
        }
        cout << levels[i];
    }
    cout << "\n";
    cout << "average=" << total / n << "\n";
    return 0;
}