Codeforces Round #379 (Div. 2) B. Anton and Digits 水题
B. Anton and Digits
题目连接:
http://codeforces.com/contest/734/problem/B
Description
Recently Anton found a box with digits in his room. There are k2 digits 2, k3 digits 3, k5 digits 5 and k6 digits 6.
Anton's favorite integers are 32 and 256. He decided to compose this integers from digits he has. He wants to make the sum of these integers as large as possible. Help him solve this task!
Each digit can be used no more than once, i.e. the composed integers should contain no more than k2 digits 2, k3 digits 3 and so on. Of course, unused digits are not counted in the sum.
Input
The only line of the input contains four integers k2, k3, k5 and k6 — the number of digits 2, 3, 5 and 6 respectively (0 ≤ k2, k3, k5, k6 ≤ 5·106).
Output
Print one integer — maximum possible sum of Anton's favorite integers that can be composed using digits from the box.
Sample Input
5 1 3 4
Sample Output
800
Hint
题意
给你2,3,5,6这四个数字的数量
让你组成256和32,使得和最大。
题解:
暴力枚举一种数的数量,然后算另外一个数的数量,然后输出答案就好了。
代码
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
long long ans = 0;
for(int i=0;i<=d;i++){
long long num = min(a,min(c,d));
long long num2 = min(a-num,1ll*b);
ans=max(ans,num*256LL+32LL*num2);
}
cout<<ans<<endl;
}
Codeforces Round #379 (Div. 2) B. Anton and Digits 水题的更多相关文章
- Codeforces Round #379 (Div. 2) D. Anton and Chess 水题
D. Anton and Chess 题目连接: http://codeforces.com/contest/734/problem/D Description Anton likes to play ...
- Codeforces Round #379 (Div. 2) A. Anton and Danik 水题
A. Anton and Danik 题目连接: http://codeforces.com/contest/734/problem/A Description Anton likes to play ...
- Codeforces Round #379 (Div. 2) D. Anton and Chess —— 基础题
题目链接:http://codeforces.com/contest/734/problem/D D. Anton and Chess time limit per test 4 seconds me ...
- Codeforces Round #404 (Div. 2) B. Anton and Classes 水题
B. Anton and Classes 题目连接: http://codeforces.com/contest/785/problem/B Description Anton likes to pl ...
- Codeforces Round #404 (Div. 2) A - Anton and Polyhedrons 水题
A - Anton and Polyhedrons 题目连接: http://codeforces.com/contest/785/problem/A Description Anton's favo ...
- Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题
Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec Memory Limit: 256 MBSubmit: xxx ...
- Codeforces Round #379 (Div. 2) A B C D 水 二分 模拟
A. Anton and Danik time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces Round #290 (Div. 2) A. Fox And Snake 水题
A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...
- Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题
A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...
随机推荐
- noip2015-day1-t2
题意:有n个同学(编号为1到n)正在玩一个信息传递的游戏.在游戏里每人都有一个固定的信息传递对象,其中,编号为i的同学的信息传递对象是编号为Ti同学.游戏开始时,每人都只知道自己的生日.之后每一轮中, ...
- 中值排序的java实现
public class MidSort { public static void main(String[] args){ ,,,,,,,,}; midSort(arr,,); for(int i: ...
- (算是dp吧) 小茗的魔法阵 (fzu 2225)
http://acm.fzu.edu.cn/problem.php?pid=2225 Problem Description 在打败了易基•普罗布朗.诺姆•普罗布朗之后,小茗同学开始挑战哈德•普罗 ...
- 解决VS2010链接错误:LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
网上有多种解决办法,我用最懒的一种,系统是Win7 X86,方法如下: C:\Windows\Microsoft.NET\Framework\v4.0.30319\cvtres.exe C:\Prog ...
- 不能运行,:framework not found SenTestingKit
1. 真机调试,提示 ld: framework not found SenTestingKit $(DEVELOPER_LIBRARY_DIR)/Frameworks
- delphi 获取图片某一像素的颜色值
前言:在VCL里有GetPixel函数,可直接用,在FMX里直接用这个函数没有定义,在FMX的library中找这个函数在FMX.Graphics.TBitmapData.GetPixel中 结果我引 ...
- Memcache的使用基本介绍
Memcache学习总结2-Memcache的使用基本介绍 上一次总结中我们已经安装部署好了Memcached,并且把PHP扩展Memcache也安装好了,这一节我们详细学习一下PHP扩展Memcac ...
- MySQL中distinct和group by性能比较[转]
MySQL中distinct和group by性能比较[转] 之前看了网上的一些测试,感觉不是很准确,今天亲自测试了一番.得出了结论(仅在个人计算机上测试,可能不全面,仅供参考) 测试过程: 准备一张 ...
- Android系统的常用权限
1.ACCES_NETWORK_STATE 允许应用程序获取网络状态信息的权限 2.ACCESS_WIFI_STATE ...
- log4j使用方法
项目在开发运行阶段,需要根据日志调试或者排错,这时候就需要有日志管理来帮助我们解决这些问题: 在java中我们可以使用System.out.println(),但是这种方式功能呢个太弱,而且不易控制, ...