Problem D

Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 945   Accepted Submission(s) : 121

Font: Times New Roman | Verdana | Georgia

Font Size: ← →

Problem Description

阿黄的银行最近有发行了一种新面额的钞票面值为4,所以现在黄有5中
面额的钞票,分别是20,10,5,4,1。但是不变的是他的小气(同题2),现在
又有很多人来取钱,黄又不开心了,请你算出每个来取钱的人黄应该给他
多少张钞票。

Input

多组样例,每组给出一个n,n为要取出的金额。(n<=10^6&&组数小于等于10^6)

Output

每组样例输出一个答案(钞票数)。

Sample Input

1

Sample Output

1

Author

moonlike
 
这个题目和1002不是一个画风的惹QAQ
同学说是dp惹,我没想到,不过我知道,把钱对20取余,看余数是多少(反正余数不会大于20的),分情况再加上还要的钞票数
#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<sstream>
#include<set>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x3fffffff
#define INF 0x3f3f3f3f
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define ULL unsigned long long
using namespace std;
int main()
{
int n;
int a;
int sum;
while(scanf("%d",&n)!=EOF)
{
sum=0;
/* int b=1+5;
int c=4+4;
int d=5+4;
int e=10+4;
int h=10+1;//取2的
int b1=3+4;
int c1=10+2;
int d1=10+5+1;
int e1=19;
int r1=18;
int t1=13;//取3的
int sum=0;*/
a=n%20;
sum+=n/20;
if(a<=3)
{
sum+=a;
}
else if(a==1||a==4||a==5||a==10)
{
sum+=1;
}
else if(a==6||a==6||a==8||a==9||a==11||a==14||a==15)
{
sum+=2;
}
else if(a==7||a==12||a==13||a==16||a==18||a==19)
{
sum+=3;
}
else if(a==3||a==17)
{
sum+=4;
}
printf("%d\n", sum); }
return 0;
}

  

华东交通大学2015年ACM“双基”程序设计竞赛1004的更多相关文章

  1. 华东交通大学2015年ACM“双基”程序设计竞赛1002

    Problem B Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other) Total Sub ...

  2. 华东交通大学2015年ACM“双基”程序设计竞赛1007

    Problem G Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other) Total Sub ...

  3. 华东交通大学2015年ACM“双基”程序设计竞赛1003

    Problem C Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other) Total Sub ...

  4. 华东交通大学2015年ACM“双基”程序设计竞赛1005

    Problem E Time Limit : 3000/2000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other) Total Sub ...

  5. 华东交通大学2015年ACM“双基”程序设计竞赛1001

    Problem A Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other) Total Sub ...

  6. 华东交通大学2016年ACM“双基”程序设计竞赛 1004

    Problem Description LB是个十分喜欢钻研的人,对什么事都要搞明白.有一天他看到一个公式,((a-b)*c+d*e)/f=k.他想如果给定K的值,一共有多少种不同整数的组合(a,b, ...

  7. 华东交通大学2018年ACM“双基”程序设计竞赛 C. 公式题 (2) (矩阵快速幂)

    题目链接:公式题 (2) 比赛链接:华东交通大学2018年ACM"双基"程序设计竞赛 题目描述 令f(n)=2f(n-1)+3f(n-2)+n,f(1)=1,f(2)=2 令g(n ...

  8. 华东交通大学2018年ACM“双基”程序设计竞赛部分题解

    链接:https://ac.nowcoder.com/acm/contest/221/C来源:牛客网 C-公式题(2) 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其 ...

  9. 华东交通大学2016年ACM“双基”程序设计竞赛 1007

    Problem Description ACM小学妹在今天的暑假训练结束后,想看球赛放松一下.当他打开电脑时查询到联盟今天直播N场球赛,每场球赛的起止时间(S1,E1),(S2,E2),...,(SN ...

随机推荐

  1. 记录下Linux难记实用的命令

    看文件大小:du -sm * | sort -n 合并多个文件,可以跨文件夹合并:cat *_.txt >> news.txt 给文件改编码:iconv -f GBK -t UTF-8 原 ...

  2. Eclipse中如何开启断言(Assert),方法有二

    Eclipse中如何开启断言(Assert),方法有二:1.Run -> Run Configurations -> Arguments页签 -> VM arguments文本框中加 ...

  3. css知多少(6)——选择器的优先级(转)

    css知多少(6)——选择器的优先级   1. 引言 上一节<css知多少(5)——选择器>最后提到,选择器类型过多将导致一些问题,是什么问题呢?咱们直接举例子说明. 上图中,css中的两 ...

  4. winform 公共控件 ListView

    //数据显示,刷新 public void F5() { listView1.Items.Clear(); List<Students> Stu = new StudentsData(). ...

  5. Opengl创建几何实体——四棱锥和立方体

    //#include <gl\glut.h>#include <GL\glut.h>#include <iostream> using namespace std; ...

  6. 771. Jewels and Stones珠宝数组和石头数组中的字母对应

    [抄题]: You're given strings J representing the types of stones that are jewels, and S representing th ...

  7. windows VS2013 编译安装QWT6.1和QWTPolar1.1.1

    QWT的编译和配置 1. 下载QWT从官网 For getting a snapshot with all bugfixes for the latest 5.2 release: svn expor ...

  8. JavaPersistenceWithMyBatis3笔记-第2章Bootstrapping MyBatis-001XMl形式和Java形式

    一. 1.Mapper 同上 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper ...

  9. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0

    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at ExTestDrive.main ...

  10. CF438D The Child and Sequence

    外国人的数据结构题真耿直 唯一有难度的操作就是区间取模,然而这个东西可以暴力弄一下,因为一个数$x$被取模不会超过$logn$次. 证明如下(假设$x Mod   y$): 如果$y \leq \fr ...