题目链接: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. SQL笔记 - 解决CTE定位点类型和递归部分的类型不匹配

    在CTE递归测试,也就是部门名称拼接的时候,遇到了小问题: 登时就迷糊了:不都是取的是Unit表中的同一个列,相加之后类型就变了么? 难道是因为,系统知道这是在进行递归运算,但又不确定递归的层次,以及 ...

  2. R中的par()函数的参数

    把R中par()函数的主要参数整理了一下(另外本来还整理了每个参数的帮助文档中文解释,但是太长,就分类之后,整理为图表,excel不便放上来,就放了这些表的截图)

  3. PHP基础文件下载类的简单封装

    1: <?php 2: /** 3: * [FileDown 公用文件下载方法] 4: * @param [type] $filePath [文件路径(绝对路径或相对路径)] 5: */ 6: ...

  4. PHP命名空间入门教程

    PHP5.3当中就引入了“命名空间”的概念,一直都没怎么关注和使用,其实学习它也挺简单的,看官方的教程就行了: 命名空间概述 定义命名空间 定义子命名空间 在同一个文件中定义多个命名空间 使用命名空间 ...

  5. MVC中下拉列表绑定方法

    方法一: 前端 @Html.DropDownListFor(a=>a.acate,ViewBag.CateList as IEnumerable<SelectListItem>) 后 ...

  6. Pcserver+oracle10g+rac

    成本的相对廉价,技术的成熟,功能的强大此方案将越来越受中小企业的青睐.     一.实验前准备 虚拟机版本:Vwareserver1.0.6 Linux版本:redhat5.5enterprise服务 ...

  7. mysql 查询某个日期时间段,每天同一时间段的数据

    mysql 查询某个日期时间段,每天同一时间段的数据: SELECT * FROM t_a01_eltable WHERE DATE_FORMAT(acqtime,'%Y-%m-%d')>='2 ...

  8. 思科 vlan 相关操作

    添加或者修改VLAN Switch(config)# vlan vlan-id Switch(config-vlan)# name vlan-name 删除VLAN Switch(config)# n ...

  9. OAuth 2.0攻击面与案例总结

    本文整理了OAuth 2.0的攻击面+实际案例+辅助测试代码. OAuth流程 本文以两种广泛使用的方案为标准展开..如对流程不了解,请先移步学习: 理解OAuth 2.0 Authorization ...

  10. Linux nohup 程序后台运行

    &方式: Unix/Linux下一般想让某个程序在后台运行,很多都是使用 & 在程序结尾来让程序自动运行.比如我们要运行mysql在后台:          /usr/local/my ...