题目链接: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. Ubuntu之Mysql安装及基本设置

    No1. Mysql 安装 sudo apt-get install mysql-server mysql-client 记得root密码别忘了. No2. 验证Mysql安装 sudo servic ...

  2. Hadoop第3周练习--Hadoop2.X编译安装和实验

    作业题目 位系统下进行本地编译的安装方式 选2 (1) 能否给web监控界面加上安全机制,怎样实现?抓图过程 (2)模拟namenode崩溃,例如将name目录的内容全部删除,然后通过secondar ...

  3. 清北暑假模拟day1 生活

    /* 数字三角形,要求第K大的值,可以推知,如果得知k的范围,那么一定是在上一行可转移状态的对应范围内(反证法可以证明),这个在背包九讲里也有提及 */ #include<cstdio> ...

  4. 第一个C++例子

    #include <iostream> using namespace std; class Time { private: int hour; int minute; int secon ...

  5. C#3.0 特性

    C#3.0特性 隐式类型的本地变量和数组 对象初始值设定项 集合初始值设定项 扩展方法 匿名类型 lambda表达式 查询关键字 自动实现的属性 分布方法定义 lambda表达式与表达式树 https ...

  6. POJ 1905 Expanding Rods

                           Expanding Rods Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 1 ...

  7. 微信 6.5.1 for iOS发布 可以在朋友圈分享相册中的视频

    今天微信 6.5.1 for iOS发布了,最主要的一个功能是可以在朋友圈分享相册中的视频,卖转发朋友圈视频软件的家伙估计要哭了.微信这次更新,更有利于个人号的运营,个人号的价值将更高.先定一个小目标 ...

  8. oracle数据表创建分区与查询

    场景: 遇到1亿数据量的数据需要根据用户名做些数据统计分析,想直接做些聚合计算基本没可能,于是打算先根据日期按照年月创建分区,然后对各个分区分别进行统计,最后汇总结果. 有两种方法,分别是手工设置分区 ...

  9. hadoop之根据Rowkey从HBase中查询数据

    1.Hbase 根据rowkey 查询 conf的配置信息如下: conf = new Configuration(); conf.set("hbase.zookeeper.quorum&q ...

  10. 【C语言入门教程】3.3 条件控制语句

    在程序的 3 种基本结构中,第二种是选择结构,选择结构是根据程序运行时获得的条件,决定程序执行情况.条件控制语句可用来实现这种结构,C 语言提供了 if 语句和 switch 语句两种条件控制语句,i ...