Vasya the Hipster
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?
Input
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.
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.
Example
3 1
1 1
2 3
2 0
7 3
3 2
Note
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.
#include<bits/stdc++.h>
using namespace std;
int main()
{
int r,b;
while(~scanf("%d %d",&r,&b))
{
int maxn = max(r,b);
int minn = min(r,b);
maxn -= minn;
int c = maxn / ;
cout<<minn<<" "<<c<<endl;
}
return ;
}
Vasya the Hipster的更多相关文章
- Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题
A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...
- cf581A Vasya the Hipster
One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red so ...
- 【Henu ACM Round#19 A】 Vasya the Hipster
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 模拟题. 两个一起用->min(a,b); 剩下的除2加上去就好 [代码] #include <bits/stdc++. ...
- Codeforces Round #322 (Div. 2)
水 A - Vasya the Hipster /************************************************ * Author :Running_Time * C ...
- Milliard Vasya's Function-Ural1353动态规划
Time limit: 1.0 second Memory limit: 64 MB Vasya is the beginning mathematician. He decided to make ...
- CF460 A. Vasya and Socks
A. Vasya and Socks time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- 递推DP URAL 1353 Milliard Vasya's Function
题目传送门 /* 题意:1~1e9的数字里,各个位数数字相加和为s的个数 递推DP:dp[i][j] 表示i位数字,当前数字和为j的个数 状态转移方程:dp[i][j] += dp[i-1][j-k] ...
- Codeforces Round #281 (Div. 2) D. Vasya and Chess 水
D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #281 (Div. 2) C. Vasya and Basketball 二分
C. Vasya and Basketball time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
随机推荐
- Java面向对象之构造函数 入门实例
一.基础概念 1.什么时候定义构造函数: 当对象创建时,需要对象必须具备的内容,通过构造函数完成. 2.一般函数和构造函数的区别: 定义上:构造函数只为对象的初始化,只执行一次.一般函数定义对象应该具 ...
- from sys import argv
from sys import argv 初学理解: sys 为内置模块,提供了许多函数和变量来处理 Python 运行时环境的不同部分.是固定的用法,不能自己随便写名字代替它,这行的作用就是要把用 ...
- digest-MD5认证
digest-MD5认证机制是基于MD5算法的LINUX安全机制认证. 会比较用户端传送的杂凑值与使用者密码的杂凑值,以认证用户端. 但由于此机制必须读取使用者密码,因此,所有想透过digest-MD ...
- java内部类、接口、集合框架、泛型、工具类、实现类
.t1 { background-color: #ff8080; width: 1100px; height: 40px } 一.内部类 1.成员内部类. (1)成员内部类的实例化: 外部类名.内部类 ...
- JS小测验
1.编写一个方法method(),判断一个数能否同时被3和5整除 <div class="one" onClick="method()"> func ...
- 文件上传详解 (HTML FILE)
FileUpload 对象 在 HTML 文档中 <input type="file"> 标签每出现一次,一个 FileUpload 对象就会被创建. 该元素包含一个文 ...
- MyBatis 框架系列之基础初始
1.什么是 MyBatis MyBatis 本是 apache 的一个开源项目 iBatis,后改名为 MyBatis,它 是一个优秀的持久层框架,对 jdbc 的操作数据库的过程进行封装,使开发者只 ...
- DDCTF 2018线上赛writeup
第一题: d4e8e1f4a0f7e1f3a0e6e1f3f4a1a0d4e8e5a0e6ece1e7a0e9f3baa0c4c4c3d4c6fbb9b2b2e1e2b9b9b7b4e1b4b7e3e ...
- 机器学习基石:09 Linear Regression
线性回归假设: 代价函数------均方误差: 最小化样本内代价函数: 只有满秩方阵才有逆矩阵. 线性回归算法流程: 线性回归算法是隐式迭代的. 线性回归算法泛化可能的保证: 根据矩阵的迹的性质:tr ...
- macOS下python3通过scrapy框架重新生成不得姐网站视频采集过程日志
1.搭建虚拟python3环境(Virtualenvwrapper) 参考http://www.cnblogs.com/it-tsz/p/pyhton.html 2.安装scrapy 前提先安装好pi ...