编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#2205 #1004. 提瓦特大冒险 Compile Error 0 0 ms 0 K C / 721 B Life4Koishi 2023-11-17 0:40:43
显示原始代码
#include <stdio.h>

int timeSpend[100001], timeReward[100001];

int main() {
    int roomTotal, rewardTotal, timeLeft;
    scanf("%d %d %d", &roomTotal, &rewardTotal, &timeLeft);

    for (int idx = 1; idx <= roomTotal - 1; idx++) scanf("%d", &timeSpend[idx]);

    for (int idx = 1, tmp; idx <= rewardTotal; idx++) {
        scanf("%d", &tmp);
        scanf("%d", &timeReward[tmp]);
    }

    int step = 1;
    for (;; step++) {
        //		printf("%d + %d - %d = %d STEP %d\n",timeLeft,timeReward[step],timeSpend[step],timeLeft
        //+ timeReward[step] - timeSpend[step],step);
        timeLeft = timeLeft + timeReward[step] - timeSpend[step];

        if (timeLeft <= 0 || step == roomTotal)
            break;
    }

    step == roomTotal ? printf("Yes") : printf("No");
}
}

编译信息

/sandbox/1/a.c:29:1: error: extraneous closing brace ('}')
}
^
1 error generated.