wa声一片

P1478 陶陶摘苹果(升级版)

jingliang_youxi @ 2024-08-07 09:43:41

求调

#include <bits/stdc++.h>
using namespace std;
long long n, s, a, b, x[1001], y[1001], sg, n1[1001], m = 99999999999, c;

int main() {
    cin >> n >> s >> a >> b;
    sg = a + b;
    for (int i = 1; i <= n; i++) {
        cin >> x[i] >> y[i];
        if (x[i] < sg) {
            n1[i] = y[i];
        }
    }
    for (int j = 1; j <= n; j++) {
        for (int i = 1; i <= n; i++) {
            if (n1[i] < m && s > n1[i]) {
                m = n1[i];
                s = s - n1[i];
                c++;
                n1[i] = 1000000000009;
                m = 99999999999;

            }
        }
    }
    cout << c;
    return 0;
}

by Kete @ 2024-08-07 10:12:50

第5个测试点输出样例是225


by Kete @ 2024-08-07 10:14:26

抱歉,第5个测试点输出样例是255


by jingliang_youxi @ 2024-08-07 10:14:54

@Kete 我嘞个5000千个苹果 陶陶家把全国的苹果全摘了


by Kete @ 2024-08-07 10:16:00

超雄の陶陶


by Kete @ 2024-08-07 10:18:31

我勒个超雄の陶陶


by jingliang_youxi @ 2024-08-07 10:25:40

@Kete 我255是对的


by Kete @ 2024-08-07 10:28:30

大脑宕机中


by __mt19937__ @ 2024-08-10 10:09:47

@Kete 这不是01吗?


上一页 |