CF1215A.Yellow Cards
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The final match of the Berland Football Cup has been held recently. The referee has shown n yellow cards throughout the match. At the beginning of the match there were a1 players in the first team and a2 players in the second team.
The rules of sending players off the game are a bit different in Berland football. If a player from the first team receives k1 yellow cards throughout the match, he can no longer participate in the match — he's sent off. And if a player from the second team receives k2 yellow cards, he's sent off. After a player leaves the match, he can no longer receive any yellow cards. Each of n yellow cards was shown to exactly one player. Even if all players from one team (or even from both teams) leave the match, the game still continues.
The referee has lost his records on who has received each yellow card. Help him to determine the minimum and the maximum number of players that could have been thrown out of the game.
贝兰德足球杯的决赛最近刚刚举行。裁判在整场比赛中总共出示了 n 张黄牌。比赛开始时,第一支队伍有 a1 名球员,第二支队伍有 a2 名球员。
贝兰德足球的罚下规则略有不同:若第一支队伍中某名球员在整场比赛中累计收到 k1 张黄牌,则该球员将被罚下场,不能再参与比赛;同理,若第二支队伍中某名球员累计收到 k2 张黄牌,也将被罚下场。一旦某名球员被罚下场,他将不再接收任何黄牌。这 n 张黄牌每张均恰好出示给一名球员。即使某支队伍(甚至两支队伍)的所有球员均已被罚下场,比赛仍将继续进行。
裁判已丢失了每张黄牌具体出示给哪位球员的记录。请帮助他确定本场比赛中可能被罚下场的球员人数的最小值和最大值。
输入格式
The first line contains one integer a1 (1≤a1≤1000) — the number of players in the first team.
The second line contains one integer a2 (1≤a2≤1000) — the number of players in the second team.
The third line contains one integer k1 (1≤k1≤1000) — the maximum number of yellow cards a player from the first team can receive (after receiving that many yellow cards, he leaves the game).
The fourth line contains one integer k2 (1≤k2≤1000) — the maximum number of yellow cards a player from the second team can receive (after receiving that many yellow cards, he leaves the game).
The fifth line contains one integer n (1≤n≤a1⋅k1+a2⋅k2) — the number of yellow cards that have been shown during the match.
第一行包含一个整数 a1(1≤a1≤1000)—— 第一队的球员人数。
第二行包含一个整数 a2(1≤a2≤1000)—— 第二队的球员人数。
第三行包含一个整数 k1(1≤k1≤1000)—— 第一队每名球员最多可获得的黄牌数(达到该数量后,该球员将被罚下场)。
第四行包含一个整数 k2(1≤k2≤1000)—— 第二队每名球员最多可获得的黄牌数(达到该数量后,该球员将被罚下场)。
第五行包含一个整数 n(1≤n≤a1⋅k1+a2⋅k2)—— 比赛中已出示的黄牌总数。
输出格式
Print two integers — the minimum and the maximum number of players that could have been thrown out of the game.
输出两个整数——可能被罚出场的球员的最少人数和最多人数。
输入输出样例
输入#1
2 3 5 1 8
输出#1
0 4
输入#2
3 1 6 7 25
输出#2
4 4
输入#3
6 4 9 10 89
输出#3
5 9
说明/提示
In the first example it could be possible that no player left the game, so the first number in the output is 0. The maximum possible number of players that could have been forced to leave the game is 4 — one player from the first team, and three players from the second.
In the second example the maximum possible number of yellow cards has been shown (3⋅6+1⋅7=25), so in any case all players were sent off.
在第一个例子中,可能没有任何球员离场,因此输出中的第一个数字为 0。可能被迫离场的球员最多有 4 人——第一支队伍中 1 人,第二支队伍中 3 人。
在第二个例子中,展示的黄牌总数已达最大可能值 (3⋅6+1⋅7=25),因此无论如何,所有球员均被罚下场。
输入解题思路,AI测评打分。不知道怎么写?