题目链接:

  http://acm.xmu.edu.cn/JudgeOnline/problem.php?id=1062

题目大意

  已知金钱,和各面额钞票张数,问最少可以换成几张。

题目思路:

  【模拟】

  暴力模拟即可。

 //
//by coolxxx
//
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<memory.h>
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//#include<stdbool.h>
#include<math.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(a) ((a)>0?(a):(-(a)))
#define lowbit(a) (a&(-a))
#define sqr(a) ((a)*(a))
#define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
#define eps (1e-8)
#define J 10000000
#define MAX 0x7f7f7f7f
#define PI 3.1415926535897
#define N 14
using namespace std;
typedef long long LL;
int cas,cass;
int n,m,lll,ans;
int c[]={,,,,,,};
int a[N],b[N];
int main()
{
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
// freopen("2.txt","w",stdout);
#endif
int i,j,k;
// for(scanf("%d",&cas);cas;cas--)
// for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
// while(~scanf("%s",s))
while(~scanf("%d",&n))
{
ans=;n=-n*;
for(i=;i<;i++)
scanf("%d",&a[i]);
for(i=;i< && n;i++)
{
if(n<c[i])continue;
b[i]=n/c[i];
b[i]=min(a[i],b[i]);
n-=b[i]*c[i];
ans+=b[i];
}
if(n)puts("-1");
else printf("%d\n",ans);
}
return ;
}
/*
// //
*/

千万不要点

【模拟】XMU 1062 山东煎饼的更多相关文章

  1. 基于gtid的复制

    Ⅰ.GTID的介绍 global transaction id identifier 全局事务id gtid = server_uuid + transaction_id server_uuid是全局 ...

  2. Spring Boot 相关

    SpringBoot工程 参数解析 HTTP Method Request / Response / Session Error/重定向 Logger IoC AOP/Aspect   1:Sprin ...

  3. 【模拟】XMU 1055 数七

    题目链接: http://acm.xmu.edu.cn/JudgeOnline/problem.php?id=1055 题目大意: 报数游戏,不能报7的倍数和2进制下含有111的数. 给定n,m(1& ...

  4. 【模拟】XMU 1054 Hacker

    题目链接: http://acm.xmu.edu.cn/JudgeOnline/problem.php?id=1054 题目大意: 多组数据,n=0结束.给定n(n<=1 000 000)和n个 ...

  5. 【数学】【模拟】XMU 1044 伪伪随机数产生器

    题目链接: http://acm.xmu.edu.cn/JudgeOnline/problem.php?id=1044 题目大意: 求首项为0,公比为x的等差数列组成的数字条的第y位数字是几.(x,y ...

  6. 【模拟】XMU 1599 斐波那契汤

    题目链接: http://acm.xmu.edu.cn/JudgeOnline/problem.php?id=1599 题目大意: 给k,m,q以及f[1]...f[k],当n<m时,f[n]= ...

  7. 10.17(山东多校联合模拟赛 day1)

    山东多校联合模拟赛 day1 题不难 rect [问题描述] 给出圆周上的 N 个点, 请你计算出以这些点中的任意四个为四个角,能构成多少个矩形. 点的坐标是这样描述的, 给定一个数组 v[1..N] ...

  8. XMU 1606 nc与滴水问题 【模拟】

    1606: nc与滴水问题 Time Limit: 1000 MS  Memory Limit: 64 MBSubmit: 85  Solved: 27[Submit][Status][Web Boa ...

  9. [2011山东ACM省赛] Mathman Bank(模拟题)

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/sr19930829/article/details/24187925 Mathman Bank ni ...

随机推荐

  1. [React Flow] Up and Running with Facebook Flow for Typed JavaScript

    Install: npm i -D flow-binnpm i -g flow-bin Init: flow init Script: "typecheck": "flo ...

  2. ping and traceroute(tracert)

    1.ping程序简单介绍 这个程序是Mike Muuss编写的.目的是測试另外一台机子是否可达. 运用的协议就是ICMP.运用的是ICMP的回显应答和请求回显两个类型.曾经呢.能ping通说明可以进行 ...

  3. 改写URL的查询字符串QUERY_STRING(转)

    查询字符串是指URL请求中“问号”后面的部分.比如,http://www.nowamagic.net/?foo=bar中粗体部分就是查询字符串,其中变量名是foo,值是bar. 1. 利用QSA转换查 ...

  4. ubuntu 安装 flash player

    ubuntu 软件中心里的 flash , 虽说写的支持 chrome , 但安装总不管用 可运行以下两个命令, 再重启 chrome 浏览器 (注意,一定要把打开的浏览器全部关闭, 再打开才可以) ...

  5. python之 sys.exit() os._exit() exit() quit()的简单使用

    python之sys.exit() os._exit() exit() quit()的简单使用 1>sys.exit() >>> import sys>>> ...

  6. ubuntu 安装eclipse

    安装步骤: 一.下载客户端: 解压放到,/opt/Java/eclipse目录下,解压方法参考上一篇文章<ubuntu 配置Java jdk> 二.打开eclipse: 打开终端,输入,c ...

  7. Android 发送验证码 简易代码

    效果 Activity ;//倒计时 private Timer timer; private Handler handler = new Handler() { public void handle ...

  8. EventBus 事件总线 原理

    原理 一句话描述:register会把当前类中匹配的方法,存入一个map,而post会根据实参去map查找进行反射调用 撇开专业术语,其实EventBus就是在内部[存储]了一堆onEvent开头的方 ...

  9. poj 1125 Stockbroker Grapevine (dij优化 0ms)

    #include<iostream> #include<cstdio> #include<cstring> #include<queue> #defin ...

  10. Django runserver show client ip

    get path of basehttp.py $ python >>> import site >>> site.getsitepackages() ['/usr ...