葉林
Linked with GitHub
# ZeroJudge - f605: 1. 購買力 ### 題目連結:https://zerojudge.tw/ShowProblem?problemid=f605 ###### tags: `ZeroJudge` ```cpp= #include <iostream> #include <algorithm> using namespace std; int main() { cin.sync_with_stdio(false); cin.tie(nullptr); int products, difference, prices[3], average, counts, total; while (cin >> products >> difference) { counts = total = 0; while (products--) { average = 0; for (int i = 0; i < 3; ++i) cin >> prices[i], average += prices[i]; sort(prices, prices + 3); if (prices[2] - prices[0] >= difference) ++counts, total += average / 3; } cout << counts << ' ' << total << '\n'; } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up