306565: CF1215A. Yellow Cards
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Yellow Cards
题意翻译
### 题目描述 ``Berland``足球杯总决赛最近举行了。整场比赛中,裁判出示了$n$张黄牌。比赛一开始,在第一队中有$a_1$个球员而在第二队中有$a_2$个。 在``Berland``足球杯中,把人罚下场的规则与正常规则略有不同。来自第一队的一个球员收到$k_1$张黄牌,他被罚下场并不能继续参加比赛了;来自第二队的球员则需要$k_2$张才会下场。下场的球员不能再收到黄牌。即使某一队(甚至两队)的球员全部被罚下场,比赛仍能继续。 裁判忘记了自己把每张黄牌罚给了谁,所以请你帮助裁判确定可能的被罚下场的人数的最小值和最大值。 ### 输入格式 共有5行,每行一个整数$a_1,a_2,k_1,k_2,n$。含义如上文所述。 保证:$1\le a_1,a_2,k_1,k_2\le1000,1\le n\le a_1*k_1+a_2*k_2$。 ### 输出格式 一行两个整数,表示可能的被罚下场的球员数的最小值和最大值。 ### 说明/提示 在第一个样例中,可能一个球员都没被罚下场,所以最小值是0;最大值是4,1个来自第一队的球员和3个来自第二队的球员。 在第二个样例中,$n$达到了可能出示的黄牌数最大值($3*6+1*7=25$),所以不论如何所有球员都得下场。题目描述
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 $ a_1 $ players in the first team and $ a_2 $ 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 $ k_1 $ 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 $ k_2 $ 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.输入输出格式
输入格式
The first line contains one integer $ a_1 $ $ (1 \le a_1 \le 1\,000) $ — the number of players in the first team. The second line contains one integer $ a_2 $ $ (1 \le a_2 \le 1\,000) $ — the number of players in the second team. The third line contains one integer $ k_1 $ $ (1 \le k_1 \le 1\,000) $ — 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 $ k_2 $ $ (1 \le k_2 \le 1\,000) $ — 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 \le n \le a_1 \cdot k_1 + a_2 \cdot k_2) $ — the number of yellow cards that have been shown during the match.
输出格式
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