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. api响应类

    接口开发响应类封装 class response{ /* * 封通信接口数据 * @param integer $code 状态码 * @param string $message 状态信息 * @p ...

  2. PAT 天梯赛 L1-034. 点赞 【MAP】

    题目链接 https://www.patest.cn/contests/gplt/L1-034 AC代码 #include <cstdio> #include <cstring> ...

  3. api token

    具体实现如下: 1. api请求客户端想服务器端一次发送用用户认证信息(用户名和密码),服务器端请求到改请求后,验证用户信息是否正确. 如果正确:则返回一个唯一不重复的字符串(一般为UUID),然后在 ...

  4. 基于R语言的数据分析和挖掘方法总结——中位数检验

    3.1 单组样本符号秩检验(Wilcoxon signed-rank test) 3.1.1 方法简介 此处使用的统计分析方法为美国统计学家Frank Wilcoxon所提出的非参数方法,称为Wilc ...

  5. Mysql主从复制原理详解

    一.为什么要做主从同步 1.读写分离,降低对主数据库的IO消耗 2.避免数据丢失 3.提高业务系统性能 二.主从同步和集群的区别 1.主从同步 一般需要两台及以上数据库服务器即可(一台用于写入数据,一 ...

  6. CSS3动画表单

    在线演示 本地下载

  7. 父元素设置overflow,绝对定位的子元素会被隐藏或一起滚动

    一般情况: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <met ...

  8. 使用concurrent.futures和ProcessPoolExecutor来替代线程和进程

    concurrent.futures和ProcessPoolExecutor这两个类实现的借口分别在不同的线程或进程中执行可调用的对象,这两个类在内部维护者一个工作线程或进程池,以及要执行的队列,这两 ...

  9. Linux 内核是如何构建

    https://github.com/MintCN/linux-insides-zh 介绍 我不会告诉你怎么在自己的电脑上去构建.安装一个定制化的 Linux 内核,这样的资料太多了,它们会对你有帮助 ...

  10. 智能穿戴设备移动APP端与外设数据传输协议

    S1 Communication Layer specifications 1. Purpose of This Document                                    ...