CF581A.Vasya the Hipster
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks.
According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the right foot.
Every day Vasya puts on new socks in the morning and throws them away before going to bed as he doesn't want to wash them.
Vasya wonders, what is the maximum number of days when he can dress fashionable and wear different socks, and after that, for how many days he can then wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got.
Can you help him?
一天,嘻哈小子瓦西娅决定数一数自己有多少只袜子。结果发现他有 a 只红色袜子和 b 只蓝色袜子。
根据最新的时尚潮流,嘻哈小子应该穿不同颜色的袜子:左脚穿红色袜子,右脚穿蓝色袜子。
瓦西娅每天早上穿上一双新袜子,并在睡觉前把它们扔掉,因为他不想洗袜子。
瓦西娅想知道:他最多能有多少天以时尚的方式穿着(即左右脚袜子颜色不同)?在此之后,他还能穿多少天同色袜子(即左右脚袜子颜色相同),直到他要么用完所有袜子,要么无法再凑出一双袜子为止?
你能帮他解决这个问题吗?
输入格式
The single line of the input contains two positive integers a and b (1 ≤ a, b ≤ 100) — the number of red and blue socks that Vasya's got.
输入仅包含一行,其中有两个正整数 a 和 b(1 ≤ a, b ≤ 100)——分别表示瓦西亚拥有的红色袜子和蓝色袜子的数量。
输出格式
Print two space-separated integers — the maximum number of days when Vasya can wear different socks and the number of days when he can wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got.
Keep in mind that at the end of the day Vasya throws away the socks that he's been wearing on that day.
输出两个用空格分隔的整数——Vasya 能穿不同袜子的最大天数,以及他能穿相同袜子的天数(直到他耗尽所有袜子,或无法再配成任意一双袜子为止)。
请注意:每天结束时,Vasya 都会扔掉当天所穿的袜子。
输入输出样例
输入#1
3 1
输出#1
1 1
输入#2
2 3
输出#2
2 0
输入#3
7 3
输出#3
3 2
说明/提示
In the first sample Vasya can first put on one pair of different socks, after that he has two red socks left to wear on the second day.
在第一个样例中,瓦西娅可以先穿一双颜色不同的袜子,之后他剩下两双红色袜子,可在第二天穿着。
输入解题思路,AI测评打分。不知道怎么写?