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?
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.
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.
3 1
1 1
2 3
2 0
7 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.
第一题太sb了就是手速题
1 #include<set> 2 #include<map> 3 #include<cmath> 4 #include<ctime> 5 #include<deque> 6 #include<queue> 7 #include<bitset> 8 #include<cstdio> 9 #include<cstdlib> 10 #include<cstring> 11 #include<iostream> 12 #include<algorithm> 13 #define LL long long 14 #define inf 0x7fffffff 15 #define pa pair<int,int> 16 #define pi 3.1415926535897932384626433832795028841971 17 using namespace std; 18 inline LL read() 19 { 20 LL x=0,f=1;char ch=getchar(); 21 while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} 22 while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} 23 return x*f; 24 } 25 int n,m; 26 int main() 27 { 28 n=read(),m=read(); 29 int mx=min(n,m); 30 n-=mx;m-=mx; 31 if (n>m)swap(n,m); 32 printf("%d %d\n",mx,m/2); 33 }