50pts,求调
查看原帖
50pts,求调
493300
WhiteMaple_楼主2023/10/20 19:56

rt,

#include <bits/stdc++.h>

using namespace std;

const int N = 10086;
int n;
int sc;
int st;

struct Problems{
    int t, s;
    int pt;
}a[N];

int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d%d", &a[i].t, &a[i].s);
        a[i].pt = 100 / a[i].t;
        sc += a[i].pt * a[i].s;
    }
    scanf("%d", &st);
    if (sc >= st)
    {
        printf("Already Au.\n");
        return 0;
    }
    for (int j = 1; j <= n; j++)
    {
        int temp = a[j].pt * (a[j].t - a[j].s);
        int c = sc;
        int cnt = 0;
        if (sc + temp < st)
        {
            printf("NaN\n");
            continue;
        }
        for (int k = 1; k <= (a[j].t - a[j].s); k++)
        {
            if (c >= st)
            {
                printf("%d\n", cnt);
                break;
            }
            cnt++;
            c += a[j].pt;
        }
    }

    return 0;
}
2023/10/20 19:56
加载中...