翻译联系 Day12

题目:Before an Exam | JXNUOJ

翻译:

Before an Exam

0ms 65536K

描述:

Tomorrow Peter has a Biology exam. He does not like this subject much, but d days ago he learnt that he would have to take this exam. Peter's strict parents made him prepare for the exam immediately, for this purpose he has to study not less than minTime and not more than maxTime hours per each i-th day. Moreover, they warned Peter that a day before the exam they would check how he has followed their instructions.

彼得明天有生物考试。 他不太喜欢这门课,但几天前他得知他必须参加这次考试。 彼得的父母严格要求他立即为考试做准备,为此,他必须每天学习不少于最少小时和不超过最大小时。 此外,他们还警告彼得,在考试前一天,他们要检查他是否遵守了他们的指示。

So, today is the day when Peter's parents ask him to show the timetable of his preparatory studies. But the boy has counted only the sum of hours sumTime spent him on preparation, and now he wants to know if he can show his parents a timetable sсhedule with d numbers, where each number sсhedule stands for the time in hours spent by Peter each i-th day on biology studies, and satisfying the limitations imposed by his parents, and at the same time the sum total of all schedule should equal to sumTime.

所以,今天是彼得的父母让他出示预科学习时间表的日子。 但男孩只有数小时的总和* sumTime *他花在准备,现在他想知道如果他可以给父母一个时间表 sсhedule和数字d,每个sсhedule的数字代表彼得每天学习的时间并且满足父母的限制, 同时,所有schedule的总和应等于sumTime。

输入:

The first input line contains two integer numbers d, sumTime (1 ≤ d ≤ 30, 0 ≤ sumTime ≤ 240) — the amount of days, during which Peter studied, and the total amount of hours, spent on preparation. Each of the following d lines contains two integer numbers minTime, maxTime(0 ≤ minTime ≤ maxTime ≤ 8), separated by a space — minimum and maximum amount of hours that Peter could spent in the i-th day.

第一行的输入包含两个整数:d,sumtime (1 ≤ d ≤ 30, 0 ≤ sumTime ≤ 240) ——彼得学习的天数和准备的总时间。接下来的d行每一行包含两个整数:mintime和maxtime(0 ≤ minTime ≤ maxTime≤ 8)。用一个空格分隔,分别代表Peter在第th天可以花费的最小和最大时间。

输出:

In the first line print YES, and in the second line print d numbers (separated by a space), each of the numbers — amount of hours, spent by Peter on preparation in the corresponding day, if he followed his parents' instructions; or print NO in the unique line. If there are many solutions, print any of them.

如果他遵循父母的指示,则在第一行输出YES,第二行输出d(用空格隔开),每个数字代表Peter在相应的日子里花在准备上的时间; 否则在唯一行中打印NO。 如果有很多解决方案,输出任何一个。 或在唯一行中输出NO。

样例输入:

1 48
5 7

样例输出:

NO

样例输入:

2 5
0 1
3 5

样例输出:

YES
1 4 
上一篇:【区块链之菜鸟入门】区块链发展史:从拜占庭将军问题到智慧契约


下一篇:渗透测试工具到底有哪些