地址:http://acm.uestc.edu.cn/#/problem/show/1554

题目:

C0ins

Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others)

There are infinite coins with values 1,2,5,101,2,5,10.

What's the minimum numbers of coins should be picked that XX and YY can be made change for?

Input

Two integers XX and YY. (1≤X,Y≤1091≤X,Y≤109)

Output

The minimum numbers of coins should be picked.

Sample input and output

Sample Input Sample Output
8 9
4

Hint

In sample, four coins 1,2,2,51,2,2,5 and 1,1,2,51,1,2,5 both can make change for 88 and 99.

Source

The 15th UESTC Programming Contest Preliminary
 
#include<iostream>
#include<algorithm>
using namespace std; long long a,b,aa,bb,ans1,ans2,ans110,ans15,ans12,ans11,ans210,ans25,ans22,ans21; int check(int a,int b)
{
long long aa,bb,ans1,ans2,ans110,ans15,ans12,ans11,ans210,ans25,ans22,ans21;
aa=bb=ans1=ans2=ans110=ans15=ans12=ans11=ans210=ans25=ans22=ans21=;
aa=a,bb=b;
if(a<||b<)
return ;
ans110+=a/;
a%=;
ans15+=a/;
a%=;
ans12+=a/;
a%=;
ans11+=a;
ans210+=b/;
b%=;
ans25+=b/;
b%=;
ans22+=b/;
b%=;
ans21+=b;
ans1=max(ans110,ans210)+max(ans15,ans25)+max(ans12,ans22)+max(ans11,ans21);
ans2=ans110+ans15+ans11+ans12;
bb-=aa;
ans2+=bb/;
bb%=;
ans2+=bb/;
bb%=;
ans2+=bb/;
bb%=;
ans2+=bb;
return min(ans2,ans1);
} int main()
{
cin>>a>>b;
if(a>b)
swap(a,b);
cout<<min(check(a,b),check(a-,b-)+);
return ;
}

The 15th UESTC Programming Contest Preliminary C - C0ins cdoj1554的更多相关文章

  1. The 15th UESTC Programming Contest Preliminary J - Jermutat1on cdoj1567

    地址:http://acm.uestc.edu.cn/#/problem/show/1567 题目: Jermutat1on Time Limit: 3000/1000MS (Java/Others) ...

  2. The 15th UESTC Programming Contest Preliminary B - B0n0 Path cdoj1559

    地址:http://acm.uestc.edu.cn/#/problem/show/1559 题目: B0n0 Path Time Limit: 1500/500MS (Java/Others)    ...

  3. The 15th UESTC Programming Contest Preliminary K - Kidd1ng Me? cdoj1565

    地址:http://acm.uestc.edu.cn/#/problem/show/1565 题目: Kidd1ng Me? Time Limit: 3000/1000MS (Java/Others) ...

  4. The 15th UESTC Programming Contest Preliminary M - Minimum C0st cdoj1557

    地址:http://acm.uestc.edu.cn/#/problem/show/1557 题目: Minimum C0st Time Limit: 3000/1000MS (Java/Others ...

  5. The 15th UESTC Programming Contest Preliminary G - GC?(X,Y) cdoj1564

    地址:http://acm.uestc.edu.cn/#/problem/show/1564 题目: G - GC?(X,Y) Time Limit: 3000/1000MS (Java/Others ...

  6. The 15th UESTC Programming Contest Preliminary H - Hesty Str1ng cdoj1551

    地址:http://acm.uestc.edu.cn/#/problem/show/1551 题目: Hesty Str1ng Time Limit: 3000/1000MS (Java/Others ...

  7. The 15th UESTC Programming Contest Preliminary D - Destr0y City cdoj1558

    地址:http://acm.uestc.edu.cn/#/problem/show/1558 题目: D - Destr0y City Time Limit: 3000/1000MS (Java/Ot ...

  8. 【set】【可持久化Trie】The 16th UESTC Programming Contest Preliminary K - Will the circle be broken

    题意:You are given an array A of N non-negative integers and an integer M. Find the number of pair(i,j ...

  9. 【字符串哈希】The 16th UESTC Programming Contest Preliminary F - Zero One Problem

    题意:给你一个零一矩阵,q次询问,每次给你两个长宽相同的子矩阵,问你它们是恰好有一位不同,还是完全相同,还是有多于一位不同. 对每行分别哈希,先一行一行地尝试匹配,如果恰好发现有一行无法对应,再对那一 ...

随机推荐

  1. [转]Shell脚本中发送html邮件的方法

    <span "="">作为运维人员,免不了要编写一些监控脚本,并将监控结果及时的发送出来.那么通过邮件发送是比较常用的一种通知方式了.通常的,如果需要发送的内 ...

  2. 修改Apache访问权限

    You don't have permission to access / on this server.错误,居然说我此台服务器上无权限,ok解决办法如下: 找到:apache文件,进入conf文件 ...

  3. 【转】Native Thread for Win32 B-Threads Synchronization(通俗易懂,非常好)

    http://www.bogotobogo.com/cplusplus/multithreading_win32B.php   Synchronization Between Threads In t ...

  4. Codeforces 417 D. Cunning Gena

    按monitor排序,然后状压DP... . D. Cunning Gena time limit per test 1 second memory limit per test 256 megaby ...

  5. ios开发之 -- 单例类

    单例模式是一种软件设计模式,再它的核心结构中指包含一个被称为单例类的特殊类. 通过单例模式可以保证系统中一个类只有一个势力而且该势力易于外界访问,从而方便对势力个数的控制并节约系统资源.如果希望在系统 ...

  6. 《Shiro框架》shiro学习中报错解决方法

    [1] 最近在学习shiro,在学习过程中出现了一个问题,报错如下: org.apache.shiro.UnavailableSecurityManagerException: No Security ...

  7. spring could Windows打包构建docker镜像到linux

    工程模拟参考:http://blog.csdn.net/forezp/article/details/70198649 一.工程结构 二.Pom配置 <build> <plugins ...

  8. 170327、Java微信支付中的扫码支付

    微信支付现在已经变得越来越流行了,随之也出现了很多以可以快速接入微信支付为噱头的产品,不过方便之余也使得我们做东西慢慢依赖第三方,丧失了独立思考的能力,这次打算分享下我之前开发过的微信支付. 一 H5 ...

  9. 170308、oracle查看被锁的表和解锁

    --以下几个为相关表SELECT * FROM v$lock;SELECT * FROM v$sqlarea;SELECT * FROM v$session;SELECT * FROM v$proce ...

  10. CH5302 金字塔【区间DP】

    5302 金字塔 0x50「动态规划」例题 描述 虽然探索金字塔是极其老套的剧情,但是有一队探险家还是到了某金字塔脚下.经过多年的研究,科学家对这座金字塔的内部结构已经有所了解.首先,金字塔由若干房间 ...