CoderForces 734B
来源:互联网 发布:手机淘宝如何取消代付 编辑:程序博客网 时间:2024/05/16 11:35
Description
Recently Anton found a box with digits in his room. There arek2 digits 2, k3 digits3, k5 digits5 and k6 digits6.
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 thank2 digits 2, k3 digits3 and so on. Of course, unused digits are not counted in the sum.
Input
The only line of the input contains four integersk2, k3, k5 andk6 — the number of digits2, 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
800
1 1 1 1
256
Hint
In the first sample, there are five digits 2, one digit 3, three digits 5 and four digits 6. Anton can compose three integers256 and one integer 32 to achieve the value256 + 256 + 256 + 32 = 800. Note, that there is one unused integer2 and one unused integer 6. They are not counted in the answer.
In the second sample, the optimal answer is to create on integer256, thus the answer is 256.
题解:水题,大意就是给你2 3 5 6的个数,让你求它们能够组成256 32的最大和,一看就知道先组256,然后再组32,其中特判一下注意数字个数别用超了。看代码。
#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>using namespace std;int main(){ int a,b,c,d,e,f; long long s=0; scanf("%d%d%d%d",&a,&b,&c,&d); e=a>c?c:a; e=e>d?d:e; /*求2 5 6个数最少的*/ s+=e*256; f=(a-e)>b?b:(a-e); s+=f*32; printf("%lld\n",s);}
- CoderForces 734B
- Coderforces 507B 易错
- Coderforces 509B
- CoderForces 510B (dfs)
- CoderForces 23B
- Coderforces 508B 简单贪心
- Coderforces #366 B Spider Man
- coderforces 2B the least round way
- coderforces 335B--Palindrome [字符串好题]
- Coderforces 598.B Queries on a String
- coderforces-701B--数学去重stl
- coderforces 702B - Powers of Two(二分)
- Coderforces 703B Mishka and trip
- CoderForces 632B Alice, Bob, Two Teams
- Coderforces 711B Chris and Magic Square
- Coderforces 716B Complete the Word
- coderforces B. Verse Pattern 字符处理
- 【CoderForces 501B】Misha and Changing Handles vector && pair
- codeforces 554B B. Ohana Cleans Up
- openwrt上单独安装python-light使用json的问题
- mysql与oracle区别
- 细节决定成败
- 自定义GridView
- CoderForces 734B
- Linux进程管理三剑客ps、htop、dstat
- [kuangbin带你飞]专题九 连通图 A - Network of Schools (强连通分量)(模板)
- 极客班
- 基于redis实现可靠的分布式锁
- vector clock向量时钟算法简介
- Linux进程间通信的方式
- laravel框架简单文件上传
- golang驱动kafka