问题4391--Yellow Cards4391: Yellow Cards
时间限制: 1 Sec 内存限制: 512 MB
提交: 0 解决: 0
[提交] [状态] [讨论版] [命题人:]题目描述
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.
Berland足球杯的决赛已经在最近举行。整个比赛中,裁判员出示n张黄牌。比赛开始时,一队有a1球员,二队有a2球员。
在Berland足球中,让球员离开比赛的规则有些不同。如果一线队的一名球员在整个比赛中收到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
(2)
6
4
9
10
89
样例输出
(1)
0 4
(2)
5 9
Note
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.
来源/分类
[提交] [状态]