Vasya the Hipster

来源:互联网 发布:如何提高mac下载速度 编辑:程序博客网 时间:2024/06/07 06:15

題目鏈接

本題屬於簡單的implementation。

ab雙不同色的襪子,求:
1. 儘量穿異色襪子,最多能穿多少天的異色襪子。即穿的時候需保證兩種顏色都有,min(a,b)即爲所求。
2. 儘量穿異色襪子的條件下,沒異色襪子穿之後,要穿多少天的同色襪子。

#include<bits/stdc++.h>using namespace std;main(){    int a,b;    cin >> a >> b;    int c = min(a,b);    cout << c << " " << (a+b-2*c)/2 << endl;}