1 条题解

  • 0
    @ 2025-10-8 17:04:26
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long LL;
    const int N=1e5+10;
    LL c[N], y[N];
    int main()
    {
        LL n, s; scanf("%lld%lld", &n, &s);
        for(int i=1; i<=n; i++) scanf("%lld%lld", &c[i], &y[i]);
        LL cmin=1e18, ans=0;
        for(int i=1; i<=n; i++)
        {
            cmin=min(cmin + s, c[i]);
            ans += cmin * y[i];
        }
        printf("%lld\n", ans);
        return 0;
    }
    
    • 1

    【贪心】[USACO05MAR] Yogurt factory G机器工厂

    信息

    ID
    3335
    时间
    1000ms
    内存
    256MiB
    难度
    4
    标签
    递交数
    73
    已通过
    33
    上传者