Time limit : 2sec / Memory limit : 256MB

Score : 200 points

Problem Statement

You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total?

Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.

Constraints

  • 0≤A,B,C≤50
  • A+B+C≥1
  • 50≤X≤20 000
  • AB and C are integers.
  • X is a multiple of 50.

Input

Input is given from Standard Input in the following format:

A
B
C
X

Output

Print the number of ways to select coins.


Sample Input 1

Copy
2
2
2
100

Sample Output 1

Copy
2

There are two ways to satisfy the condition:

  • Select zero 500-yen coins, one 100-yen coin and zero 50-yen coins.
  • Select zero 500-yen coins, zero 100-yen coins and two 50-yen coins.

Sample Input 2

Copy
5
1
0
150

Sample Output 2

Copy
0

Note that the total must be exactly X yen.


Sample Input 3

Copy
30
40
50
6000

Sample Output 3

Copy
213

直接暴力枚举

代码:
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iomanip>
using namespace std;
int a,b,c,x,d; int main()
{
cin>>a>>b>>c>>x;
for(int i = ;i <= a;i ++)
{
for(int j = ;j <= b;j ++)
{
for(int k = ;k <= c;k ++)
if(i * + j * + k * == x)d ++;
}
}
cout<<d<<endl;
}

AtCoder Beginner Contest 087 B - Coins的更多相关文章

  1. AtCoder Beginner Contest 087 (ABC)

    A - Buying Sweets 题目链接:https://abc087.contest.atcoder.jp/tasks/abc087_a Time limit : 2sec / Memory l ...

  2. AtCoder Beginner Contest 087 D - People on a Line

    Time limit : 2sec / Memory limit : 256MB Score : 400 points Problem Statement There are N people sta ...

  3. AtCoder Beginner Contest 087 D People on a Line(DFS)

    题意 给出n个点,m组关系L,R,D,L在R的左边距离D,判断是否存在n个人的位置满足m组关系 分析 Consider the following directed graph G: There ar ...

  4. AtCoder Beginner Contest 136

    AtCoder Beginner Contest 136 题目链接 A - +-x 直接取\(max\)即可. Code #include <bits/stdc++.h> using na ...

  5. AtCoder Beginner Contest 184 题解

    AtCoder Beginner Contest 184 题解 目录 AtCoder Beginner Contest 184 题解 A - Determinant B - Quizzes C - S ...

  6. AtCoder Beginner Contest 100 2018/06/16

    A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E8 ...

  7. AtCoder Beginner Contest 052

    没看到Beginner,然后就做啊做,发现A,B太简单了...然后想想做完算了..没想到C卡了一下,然后还是做出来了.D的话瞎想了一下,然后感觉也没问题.假装all kill.2333 AtCoder ...

  8. AtCoder Beginner Contest 053 ABCD题

    A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...

  9. AtCoder Beginner Contest 137 F

    AtCoder Beginner Contest 137 F 数论鬼题(虽然不算特别数论) 希望你在浏览这篇题解前已经知道了费马小定理 利用用费马小定理构造函数\(g(x)=(x-i)^{P-1}\) ...

随机推荐

  1. VC6.0中添加库文件和头文件

    附加头文件包含 VC6.0中: VC6.0默认include包含路径:Tools>Options>Directories>Include files. 对于特定项目的头文件包含,在“ ...

  2. ETL应用:一种一次获取一个平台接口文件的方法

    ETL应用场景中,若对端接口文件未能提供,任务会处于循环等待,直到对端提供为止,该方法极大的消耗了系统资源.为此想到了一种方法,一次获取一个平台的文件,实现思路如下: 1.第一次获取对端平台提供目录下 ...

  3. JS 中 Date() 的其他操作集锦

    好吧,这周完全是个业务型的程序猿了,明显地能感觉到洗头发时头皮都会有点疼,是秃顶的前兆. 算得上收获的就是有较多的接触到计算时间方面的事件...嗯,几个笔记分享一下 // 处理 /Date(" ...

  4. 生产&消费者模型

    import queue,threading,time ,random q = queue.Queue() def producer(): count = 1 while count <11: ...

  5. Shell编程基础及变量

    一.Shell脚本 1.Shell脚本的建立 由Linux命令.shell命令.程序结构控制语句和注释等内容组成. 脚本第一行 #!/bin/bash #!字符称为幻数,内核会根据它后面的解释器来确定 ...

  6. vue项目的webpack设置请求模拟数据的接口方法

    最近在跟着视频写饿了吗vue项目,其中模拟数据由于webpack版本变化,跟视频中不一致,下方博客有解决方案,其实视频里面的还能看懂,现在webpack的服务都在插件包里了,好难找. 请参考:http ...

  7. 20165101刘天野 2017-2018-2 《Java程序设计》第4周学习总结

    #20165101刘天野 2017-2018-2 <Java程序设计>第4周学习总结 教材学习内容总结 第五章:子类与继承 面向对象程序设计语言有三大特性:封装.继承和多态性.继承是面向对 ...

  8. SpringMVC实现AJax以及RestFull风格

    RestFull风格就是url路径中不能出现?不能带参数,如https://www.baidu.com/user/item/1234这个格式,也叫url资源定位 1.需要在web.xml中开启put, ...

  9. 【P2158】仪仗队&欧拉函数详解

    来一道数论题吧. 这个题一眼看上去思路明确,应该是数论,但是推导公式的时候却出了问题,根本看不出来有什么规律.看了马佬题解明白了这么个规律貌似叫做欧拉函数,于是就去百度学习了一下这东西. 欧拉函数的含 ...

  10. jar 冲突解决方案

    val urlOfClass = classOf[Nothing].getClassLoader.getResource("org/slf4j/spi/LocationAwareLogger ...