Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
101310 | 王子毅 | 大力水手吃蔬菜 | C++ | Wrong Answer | 0 MS | 272 KB | 542 | 2024-12-14 19:48:54 |
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> amounts(n); vector<int> prices(n); for (int i = 0; i < n; i++) { cin >> amounts[i]; cin >> prices[i]; } int totalCost = 0; for (int i = 0; i < n; i++) { int minPriceIndex = min_element(prices.begin(), prices.end()) - prices.begin(); totalCost += amounts[i] * prices[minPriceIndex]; } cout << totalCost << endl; return 0; }
------Input------
61 32 21 3 85 49 35 96 89 89 36 89 65 19 25 63 41 1 27 55 57 4 31 97 81 7 60 89 97 51 49 8 17 59 21 41 68 78 5 89 26 50 1 72 51 61 44 38 31 17 14 96 93 85 44 36 58 81 42 19 61 51 11 72 81 1 47 67 13 29 51 6 92 98 91 54 21 31 41 37 13 67 69 74 53 72 7 16 25 95 71 21 93 71 37 21 4 96 1 56 18 41 90 47 33 81 13 65 19 16 28 59 32 99 91 11 93 26 13 25 57 55 21
------Answer-----
20410
------Your output-----
3134