QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#227371#3427. Getting Rid of CoinsBashca#WA 0ms3352kbC++23924b2023-10-27 13:28:412023-10-27 13:28:42

Judging History

你现在查看的是最新测评结果

  • [2023-10-27 13:28:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3352kb
  • [2023-10-27 13:28:41]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
    int p;
    int n[4];
    cin>>p;
    int v[4] = {1, 5, 10, 25};
    for (int i=0; i<4; ++i) cin>>n[i];
    int ans = 0;
    for (int i = 0; i < 30; ++i) {
        for (int j = 0; j < 10; ++j) {
            for (int k = 0; k < 10; ++k) {
                int t[4];
                t[0] = max(0, n[0] - i);
                t[1] = max(0, n[1] - j);
                t[2] = max(0, n[2] - k);
                t[3] = n[3];
                int pp = p;
                int lans = 0;
                for (int d = 0; d < 4; ++d) {
                    int f = min(pp / v[d], t[0]);
                    lans += f;
                    pp -= f * v[d];
                }
                if (pp == 0) ans = max(ans, lans);
            }
        }
    }
    if (ans == 0) cout << "Impossible" << '\n';
    else cout << ans << '\n';
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3352kb

input:

14
11 0 1 1

output:

10

result:

wrong answer 1st lines differ - expected: '5', found: '10'