题目地址:http://codeforces.com/problemset/problem/581/A
A. Vasya the Hipster
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
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.

Examples
inputCopy
3 1
outputCopy
1 1
inputCopy
2 3
outputCopy
2 0
inputCopy
7 3
outputCopy
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.
题目翻译:这个人有红色短袜A只,蓝色短袜B只,问这个人穿不同颜色袜子能穿几天,穿相同颜色袜子有几天
解题思路:直接模拟。

#include<iostream>
using namespace std;
int main()
{int a,b;cin >> a >> b;cout<<min(a,b)<<" "<<(max(a,b)-min(a,b))/2<<endl;return 0;}

CF 581A Vasya the Hipster相关推荐

  1. 【Codeforces】A2组刷题记录(50 / 50)完结

    目录 A1. Counterexample A2. Good Number A3. Dice Tower ★A4. Alyona and Numbers A5. Mountain Scenery rz ...

  2. CF Edu54 E. Vasya and a Tree DFS+树状数组

    Vasya and a Tree 题意: 给定一棵树,对树有3e5的操作,每次操作为,把树上某个节点的不超过d的子节点都加上值x; 思路: 多开一个vector记录每个点上的操作.dfs这颗树,同时以 ...

  3. cf Educational Codeforces Round 48 C. Vasya And The Mushrooms

    原题: C. Vasya And The Mushrooms time limit per test2 seconds memory limit per test256 megabytes input ...

  4. 【CF EDU59 E】 Vasya and Binary String (DP)

    题意 给一串01串,对该串进行若干次操作,直到串为空 操作为:选择一段连续的0或者1,删除它,拼接前后两部分成为新串,得到价值为a[删除的长度](a为给定的数组) 思路 一个非常规的DP 考虑题目所给 ...

  5. [CF1107E]Vasya and Binary String【区间DP】

    题目描述 Vasya has a string s of length n consisting only of digits 0 and 1. Also he has an array a of l ...

  6. cf Educational Codeforces Round 133 C. Robot in a Hallway

    原题: There is a grid, consisting of 2 rows and m columns. The rows are numbered from 1 to 2 from top ...

  7. 『参考』.net CF组件编程(4)——为自定义组件添加工具箱图标!

    前言: 在前三篇的文章中,和大家一起创建了一个用于TCP连接检测的小组件,如果你记不得了,可以通过以下链接去回顾一下: 『参考』.net CF组件编程(1)--基础之后 『参考』.net CF组件编程 ...

  8. Codewars Vasya - Clerk--6 kyu--Python解法

    Codewars Vasya - Clerk–6 kyu–Python解法 Codewars 是一个跟LeetCode类似的结题网站. Codewars题解专栏:Codewars题解 题目地址:Tra ...

  9. OC对象 vs CF对象

    2019独角兽企业重金招聘Python工程师标准>>> OC对象 vs CF对象 在ARC场景下,对象所有权没有转换 使用__bridge关键字即可实现CF对象和OC对象之间的自由转 ...

  10. CF 990A. Commentary Boxes【数学/模拟】

    [链接]:CF [题意]:对于一个数n,每次加一的代价是a,每次减一的代价是b,求被m整除时的最小代价. [分析]:分情况讨论,自己多举几个栗子. [代码]: #include<cstdio&g ...

最新文章

  1. 大智慧825 自选股 导出_互联网技术更新智慧党校迎来发展契机-威尔 WEDS-BP31_济南考勤机行情...
  2. java的类型默认存储类型_java 问题:保存对话框的默认文件类型?
  3. 如何查看CO凭证号码及明细
  4. Java @override报错的解决方法
  5. fmt—fmt:formatDate的输出格式
  6. 设计模式之GOF23原型模式02
  7. [MySQL] - MySQL的Grant命令
  8. tornado(五)
  9. vue 加入对比 3种方法
  10. uniapp微信小程序地图中叠加polygon
  11. 【leetcode】解数独
  12. 地理生物结业考_地理、生物结业主要考什么?
  13. 程序员常见常用的英语单词
  14. IDM试用到期怎么办
  15. [西方哲学史 导图001]作为意志与表象的世界 叔本华 读书导图
  16. 空格键 还是 Tab键?
  17. 运行java maven项目提醒 -SNAPSHOT.jar中没有主清单属性(maven项目指定主类)
  18. 关于售前、售后、产品、市场、销售几个部门职能的理解
  19. WMF格式图片的特点
  20. PyTorch 中 torch.optim优化器的使用

热门文章

  1. 五款超级易用的网络监控软件
  2. winfrom 水晶按钮
  3. ios适配iPhone和iPad
  4. SQL高级查询—实验报告
  5. win11如何切换输入法 win11快速切换输入法
  6. 网盘上传文件服务器失败原因,win7系统在百度网盘上传文件一直失败的解决方法...
  7. 改变文本颜色和字体大小的脚本
  8. 《林林数据结构笔记》线段树求数组区间和,单点更新,区间更新+lazy思想
  9. 查询具体详情 数据后面拼接属性
  10. imagemagick gif制作