四大文化赛道完整展开
03-execution/run-002/source-snapshot/main.cpp
main.cpp
站内文件视图直接读取仓库内容,Markdown 使用文档排版渲染,其余文本文件保持原始排版,方便校对训练证据链。
文件类型.cpp
10-cases/s2-jh-04-tactical-decision/03-execution/run-002/source-snapshot/main.cpp
#include <iostream>
#include <string>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int food_cap, med_cap, n;
if (!(cin >> food_cap >> med_cap)) {
return 0;
}
cin >> n;
int feasible = 0;
bool has_best = false;
int best_score = 0;
int best_days = 0;
int best_food_left = food_cap;
int best_med_left = med_cap;
string best_name;
for (int i = 0; i < n; ++i) {
string name;
int food, med, days, morale;
cin >> name >> food >> med >> days >> morale;
if (food > food_cap || med > med_cap) {
continue;
}
++feasible;
int score = morale * 3 - days - food - med;
if (!has_best ||
score > best_score ||
(score == best_score && (days < best_days ||
(days == best_days && name < best_name)))) {
has_best = true;
best_score = score;
best_days = days;
best_name = name;
best_food_left = food_cap - food;
best_med_left = med_cap - med;
}
}
if (!has_best) {
cout << "feasible=0\n";
cout << "best=NONE\n";
cout << "reserve=" << food_cap << ' ' << med_cap << "\n";
return 0;
}
cout << "feasible=" << feasible << "\n";
cout << "best=" << best_name << ' ' << best_score << "\n";
cout << "reserve=" << best_food_left << ' ' << best_med_left << "\n";
return 0;
}