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 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了就是手速题
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<deque>
#include<queue>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
#define inf 0x7fffffff
#define pa pair<int,int>
#define pi 3.1415926535897932384626433832795028841971
using namespace std;
inline LL read()
{
LL x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int n,m;
int main()
{
n=read(),m=read();
int mx=min(n,m);
n-=mx;m-=mx;
if (n>m)swap(n,m);
printf("%d %d\n",mx,m/);
}
cf581A
cf581A 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 ...
- 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 ...
随机推荐
- C#量转换为汉字表达
/* 创造者:菜刀打好博客 * 创建日期: 2014年09一个月04号码 * 特征:Money类型转换 * */ namespace Net.String.ConsoleApplication ...
- Java编程 的动态性,第 2部分: 引入反射--转载
在“ Java编程的动态性,第1部分,”我为您介绍了Java编程类和类装入.该篇文章介绍了一些Java二进制类格式的相关信息.这个月我将阐述使用Java反射API来在运行时接入和使用一些相同信息的基础 ...
- [转] 在 Linux 中怎样使用cp命令合并目录树
PS:通过cp -r --link a/* b/* merged 硬链接不需要复制 怎样将两个布局相似的目录树合并成一个新的目录树?为理解该问题让我们思考下面的例子. 假设 dir1 和 dir2 目 ...
- [Linux]三种方案在Windows系统下安装ubuntu双系统(转)
在学习linux的过程中,ubuntu无疑是初学者的最佳选择. 下面来列举给Windows系统安装ubuntu双系统的三种方法. 一.虚拟机安装(不推荐) 使用工具:Vmware 如果不是因为迫不得已 ...
- IIS 7.5 配置伪静态
IIS 7.5 配置伪静态_win服务器_脚本之家 win7下IIS的安装和配置 图文教程详细出处参考:http://www.jb51.net/article/29787.htm http://blo ...
- How to Install Tomcat
Read:http://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html
- iptables阻止服务器被攻击
下列规则将会阻止来自某一特定IP范围内的数据包,因为该IP地址范围被管理员怀疑有大量恶意攻击者在活动: # iptables -t filter -A INPUT -s 123.456.789.0/ ...
- 在浏览器中打不开Oracle 11gR2的企业管理器页面
最简单的办法,重建EM 四个步骤: emca -repos drop emca -repos create emca -config dbcontrol db emctl start dbconsol ...
- 高放的c++学习笔记之模板与泛型编程
函数模板 作用 有很多时候参数的类型以及返回值的类型是可变的,我们通过定义模板来让函数能更灵活的运用. 我们设计一个比较函数,如果能比较的两个参数是int型的,两个参数也可能都是string型的,单独 ...
- QT高级运用之粒子模拟(Particle Simulations)
粒⼦模拟是计算机图形技术的可视化图形效果.典型的效果有:落叶,⽕焰,爆炸,流星,云等等.它不同于其它图形渲染, 粒⼦是基于模糊来渲染.它的结果在基于像素下是不可预测的.粒⼦系统的参数描述了随机模拟的边 ...