UVALive 5840 数学题
DES:给出三种材料A,B,C每种的个数。然后组合AB,BC,AC的利润。问能获得的最大利润是多少。
开始一点思路都没有。然后发现可以枚举其中两种的个数。那么最后一种就确定了。还是感觉很机智。
#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std; int main()
{
int t;
int ab, bc, ac;
int a, b, c;
scanf("%d\n", &t);
while(t--)
{
scanf("%d%d%d%d%d%d", &a, &b, &c, &ab, &bc, &ac);
int ans = ;
//cout << "ab bc ac\n";
for (int i=; i<=a; ++i) //ab
{
for (int j=; j<=b-i; ++j) //bc
{
int tt;
if (a-i > c-j) tt = c-j; //ac
else tt = a-i;
if (tt < ) continue;
//cout << tt << "==\n";
if (i+j>b || i+tt>a || j+tt>c) continue;
int ttt = ab*i + j*bc + tt*ac;
//cout << i << "==" << j << "==" << tt << endl;
//cout << ttt << endl;
if (ans < ttt) ans = ttt;
}
}
printf("%d\n", ans);
}
return ;
}
UVALive 5840 数学题的更多相关文章
- Gym 101194H / UVALive 7904 - Great Cells - [数学题+快速幂][2016 EC-Final Problem H]
题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?opti ...
- UVALive 6084 Happy Camper(数学题)
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...
- UVALive - 4108 SKYLINE[线段树]
UVALive - 4108 SKYLINE Time Limit: 3000MS 64bit IO Format: %lld & %llu Submit Status uDebug ...
- UVALive - 3942 Remember the Word[树状数组]
UVALive - 3942 Remember the Word A potentiometer, or potmeter for short, is an electronic device wit ...
- UVALive - 3942 Remember the Word[Trie DP]
UVALive - 3942 Remember the Word Neal is very curious about combinatorial problems, and now here com ...
- ytu 2558: 游起来吧!超妹!(水题,趣味数学题)
2558: 游起来吧!超妹! Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 7 Solved: 3[Submit][Status][Web Board ...
- sdut 2416:Fruit Ninja II(第三届山东省省赛原题,数学题)
Fruit Ninja II Time Limit: 5000MS Memory limit: 65536K 题目描述 Have you ever played a popular game name ...
- 思维 UVALive 3708 Graveyard
题目传送门 /* 题意:本来有n个雕塑,等间距的分布在圆周上,现在多了m个雕塑,问一共要移动多少距离: 思维题:认为一个雕塑不动,视为坐标0,其他点向最近的点移动,四舍五入判断,比例最后乘会10000 ...
- UVALive 6145 Version Controlled IDE(可持久化treap、rope)
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...
随机推荐
- 20145333茹翔 Exp5 MSF基础应用
20145333茹翔 Exp5 MSF基础应用 实验内容 掌握metasploit的基本应用方式,掌握常用的三种攻击方式的思路. 一个主动攻击,如ms08_067; 一个针对浏览器的攻击,如ms11_ ...
- 20145326蔡馨熠《网络对抗》shellcode注入&Return-to-libc攻击深入
20145326蔡馨熠<网络对抗>shellcode注入&Return-to-libc攻击深入 准备一段shellcode 首先我们应该知道,到底什么是shellcode.经过上网 ...
- Python3基础 函数 未指定返回值,返回NONE
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础 __delattr__ 在一个属性被删除时的行为
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- luogu1049装箱问题
装箱问题 传送门 一个箱子容量为V//容量 同时有n个物品//n个 体积&&价值 要求n个物品中任取若干个装入箱内,使箱子的剩余空间为最小// v减去价值最大 */ #include& ...
- SpringBoot添加自定义消息转换器
首先我们需要明白一个概念:springboot中很多配置都是使用了条件注解进行判断一个配置或者引入的类是否在容器中存在,如果存在会如何,如果不存在会如何. 也就是说,有些配置会在springboot中 ...
- POJ 1029 False coin
http://poj.org/problem?id=1029 题意: 在一堆硬币中有一个假硬币,重量是重是轻不知道.每次称量多个硬币,并给出称量结果.判断依据题目给出的几次称量结果能否找出假硬币. 思 ...
- java基础学习总结——线程(一)
一.线程的基本概念
- js 对call apply bind理解
请参考 http://www.cnblogs.com/xljzlw/p/3775162.html 1.call和apply的区别:参数类型不同var mtt = { name: "mtt&q ...
- OpenGL入门程序二:绘制简单的圆
学习 绘制一个圆: ; const float Pi = 3.1415926536f; const float R = 0.5f; //绘制一个圆 void DrawCircle() { //绘制一个 ...