codeforces 519 C. A and B and Team Training
http://codeforces.com/problemset/problem/519/C 题意:两种组队方式,3人一组,1个大牛+2个蒟蒻或者1个蒟蒻+2个大牛。给定大牛和蒟蒻的个数。问最多能组多少队。 思路:线性规划。设两种队分别有x,y个即可。 突然发现这题以前做过。。。比当时的代码简单了一些。还不错。
1/* ***********************************************
2Author :111qqz
3Created Time :2015年12月14日 星期一 18时31分10秒
4File Name :code/cf/problem/519C.cpp
5************************************************ */
6
7#include <cstdio>
8#include <cstring>
9#include <iostream>
10#include <algorithm>
11#include <vector>
12#include <queue>
13#include <set>
14#include <map>
15#include <string>
16#include <cmath>
17#include <cstdlib>
18#include <ctime>
19#define fst first
20#define sec second
21#define lson l,m,rt<<1
22#define rson m+1,r,rt<<1|1
23#define ms(a,x) memset(a,x,sizeof(a))
24typedef long long LL;
25#define pi pair < int ,int >
26#define MP make_pair
27
28using namespace std;
29const double eps = 1E-8;
30const int dx4[4]={1,0,0,-1};
31const int dy4[4]={0,-1,1,0};
32const int inf = 0x3f3f3f3f;
33int n,m;
34int main()
35{
36 #ifndef ONLINE_JUDGE
37// freopen("code/in.txt","r",stdin);
38 #endif
39 int ans = 0;
40 cin>>n>>m;
41 if (n>m) swap(n,m);
42 if (m>=2*n)
43 ans = n ;
44 else ans= (m+n)/3;
45
46 cout<<ans<<endl;
47
48 #ifndef ONLINE_JUDGE
49 fclose(stdin);
50 #endif
51 return 0;
52}