题目链接:http://codeforces.com/contest/519/problem/C

题目意思:给出 n 个  experienced participants  和 m 个 newbies ,需要组成尽量多的组,组由3个人组成。有两种组合方式:(1)1 个 experienced participant 和 2 个  newbie  (2)2 个

experienced participant 和 1 个  newbie。问最多能组成的组数是多少组。

  昨天做的时候不是暴力做的,惯性思维所害!以为只有两种情况:尽可能多的方式(1) 或者尽可能多的方式(2)。这样做一直过不了pretest 5!

  暴力改回就过了!

 #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std; int cal(int n, int m)
{
int res = ;
for (int i = ; i <= n; i++) {
int tn = min(i, m/);
int tm = m - tn*;
int t = min((n-i)/, tm);
res = max(res, tn+t);
}
return res;
} int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif // ONLINE_JUDGE int n, m;
while (scanf("%d%d", &n, &m) != EOF) {
printf("%d\n", max(cal(n, m), cal(m, n)));
}
return ;
}

PS: 纪念第300篇博客完成[^__^] !!毕业设计完成前最后一篇博客!答辩后再见!

codeforces 519C. A and B and Team Training 解题报告的更多相关文章

  1. codeforces 519C.. A and B and Team Training

    C. A and B and Team Training time limit per test 1 second memory limit per test 256 megabytes input ...

  2. codeforces 489C.Given Length and Sum of Digits... 解题报告

    题目链接:http://codeforces.com/problemset/problem/489/C 题目意思:给出 m 和 s,需要构造最大和最小的数.满足长度都为 m,每一位的数字之和等于 s. ...

  3. Winter-2-STL-G Team Queue 解题报告及测试数据

    Time Limit:3000MS     Memory Limit:0KB Description Queues and Priority Queues are data structures wh ...

  4. codeforces 454B. Little Pony and Sort by Shift 解题报告

    题目链接:http://codeforces.com/problemset/problem/454/B 题目意思:给出一个序列你 a1, a2, ..., an. 问每次操作只能通过将最后一个数拿出来 ...

  5. [codeforces contest 1119 F] Niyaz and Small Degrees 解题报告 (树形DP+堆)

    interlinkage: http://codeforces.com/contest/1119/problem/F description: 有一颗$n$个节点的树,每条边有一个边权 对于一个$x$ ...

  6. Codeforces Round #335 (Div. 2)B. Testing Robots解题报告

                                                                                               B. Testin ...

  7. Codeforces Round #294 (Div. 2)C - A and B and Team Training 水题

    C. A and B and Team Training time limit per test 1 second memory limit per test 256 megabytes input ...

  8. CF A and B and Team Training (数学)

    A and B and Team Training time limit per test 1 second memory limit per test 256 megabytes input sta ...

  9. 294 div2 C. A and B and Team Training

    C. A and B and Team Training 题目:A and B are preparing themselves for programming contests. An import ...

随机推荐

  1. Nginx 502 bad gateway问题的解决方法

    Nginx 502 Bad Gateway的含义是请求的PHP-CGI已经执行,但是由于某种原因(一般是读取资源的问题)没有执行完毕而导致PHP-CGI进程终止,一般来说Nginx 502 Bad G ...

  2. notepad++和sublime 常用插件及主题

    sublime: 常用主题有: Pastels on Dark Monokai Zenburnsque 常用插件有 Anaconda Package Control Side Bar ConvertT ...

  3. Ubuntu使用ApkTool进行APK反编译

    1.Apktool下载 http://ibotpeaches.github.io/Apktool/ 下载最新版本Apktool_2.1.1.jar 2.新建一个apktool目录,将Apktool_2 ...

  4. php面向对象面试题

    php面试题之四--PHP面向对象(基础部分) 四.PHP面向对象 1. 写出 php 的 public.protected.private 三种访问控制模式的区别(新浪网技术部) public:公有 ...

  5. Mysql BLOB和TEXT类型

      BLOB是一个二进制大对象,可以容纳可变数量的数据.有4种BLOB类型:TINYBLOB.BLOB.MEDIUMBLOB和LONGBLOB.它们只是可容纳值的最大长度不同. A binary la ...

  6. 纯CSS多级菜单

    主要代码部分: /*新增的二级菜单部分*/ .menu ul ul { visibility:hidden;/*开始时是隐藏的*/ position:absolute; left:0px; top:3 ...

  7. Merge k Sorted Lists Leetcode Java

    Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 使 ...

  8. Android学习笔记(十一)——ListView的使用(下)

    //此系列博文是<第一行Android代码>的学习笔记,如有错漏,欢迎指正! ListView 这个控件比较复杂, 就是因为它有很多的细节可以优化,下面我们在试试提高它的运行效率:一.提高 ...

  9. Windows8笔记

    一.WIN8 硬盘变为可弹出设备 如果电脑使用的是nforce芯片组的主板和串口硬盘.在系统中安装好所有的硬件驱动程序后,会出现这种情况.这是nforce芯片组在安装了IDE-SW主板驱动以后,系统会 ...

  10. LAMP环境的安装

    感觉一下子喜欢上了ubuntu.界面特别舒服.打算物理机装ubuntu了都. 00x1 LINUX linux我安装过了就不演示了,百度经验的一篇文章:http://jingyan.baidu.com ...