本文主要是介绍CF4B--Before an Exam翻译,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
原题链接--
https://acs.jxnu.edu.cn/problem/CF4Bhttps://acs.jxnu.edu.cn/problem/CF4B
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 minTimei and not more than maxTimei 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сhedulei 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 schedulei should equal to sumTime.
译文:明天皮特有个生物学考试。他不是很喜欢这门学科 ,但是第d天前他知道他必须参加这门考试。皮特的严厉的父母让他立刻准备这场考试,为了达成这个目的他必须学习不少于minTimei小时不多于maxTime小时每i天。与此同时,他们还警告皮特在考试之前的一天还会检查他怎样遵守他们的命令。
所以今天就是这一天皮特的父母让他来展示他准备性学习的时间表 。但是男孩只计算了花在准备期的总时间sumTime,现在他想知道他是否能展示给他的父母一个有d个数字的时间表,每个数字schedulei都代表皮特每i天花在生物学习上的时间,并且满足他父母的强制限制,同时schedulei的总和等于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 minTimei, maxTimei (0 ≤ minTimei ≤ maxTimei ≤ 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行包含两个整数minTimei, maxTimei (0 ≤ minTimei ≤ maxTimei ≤ 8),用一个空格分开—minimum和maximum皮特可以花在i天的总小时数。
输出:
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个数字(用空格分开)。否则打印NO在单独的一行。如果有多种解决方案,打印其中一种。
样例输入:
1 48 5 7
样例输出:
NO
样例输入:
2 5 0 1 3 5
样例输出:
YES 1 4
这篇关于CF4B--Before an Exam翻译的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!