Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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 atter 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? Input The single line of the input contains two positive integers a and b(1a,b100) - the number of red and blue socks that Vasya's got. Output 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Have I incorporated my research into my outline effectively?

Answered: 1 week ago