【DidaOJ】[1132]感恩节KK专场——考试来了

文章字数:216

问题描述

问题分析

由于每日积累的时间与精力总是能消耗而不会浪费,因此直接判断总共能提供的时间和精力即可。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<stdio.h>

struct ClassData
{
    int t;
    int m;
} classList[120];

int main()
{
    int T;
    scanf("%d", &T);
    while (T--)
    {
        int n;
        scanf("%d", &n);
        int a, b, d;
        scanf("%d %d %d", &a, &b, &d);
        for (int i = 0; i < n; i++)
        {
            scanf("%d %d", &classList[i].t, &classList[i].m);
        }
        int totalTime = a * d;
        int totalMoney = b * d;
        for (int i = 0; i < n; i++)
        {
            totalTime -= classList[i].t;
            totalMoney -= classList[i].m;
        }
        if (totalTime >= 0 && totalMoney >= 0)
        {
            printf("YES\n");
        }
        else
        {
            printf("NO\n");
        }
    }
    return 0;
}

题目地址:感恩节KK专场——考试来了 - 问题详情 - 题目 - DidaOJ

该内容采用 CC BY-NC-SA 4.0 许可协议。

如果对您有帮助或存在意见建议,欢迎在下方评论交流。

加载中...