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. Incomplete response received from application

    RAILS_ENV=production rake secret 将输出的一大串字码粘贴到rails工程中/config/secrets.yml去,替换掉该文件中的<%= ENV["S ...

  2. node做验证码

    使用了ccap插件 1.安装: 通用方法:npm install ccap 2. cnst ccap= require('ccap')({ width: 128, height: 40, offset ...

  3. list— 把数组中的值赋给一组变量

    (PHP 4, PHP 5, PHP 7) list — 把数组中的值赋给一组变量 array list ( mixed $var1 [, mixed $... ] ) 像 array() 一样,这不 ...

  4. 线性代数:Ax=b的解

    n列的矩阵A,当且仅当向量b是列空间C(A)的一个向量时,Ax=b有解. C(A)的零空间是N(A),N(A)正交补是A的行空间C(T(A)), 依据上一章的结论,任何Rn向量可以表示为r+n,其中n ...

  5. 机器学习性能指标之ROC和AUC理解与曲线绘制

    一. ROC曲线 1.roc曲线:接收者操作特征(receiveroperating characteristic),roc曲线上每个点反映着对同一信号刺激的感受性. 横轴:负正类率(false po ...

  6. poj 1703 Find them, Catch them 【并查集 新写法的思路】

    题目地址:http://poj.org/problem?id=1703 Sample Input 1 5 5 A 1 2 D 1 2 A 1 2 D 2 4 A 1 4 Sample Output N ...

  7. poj 1265 Area【计算几何:叉积计算多边形面积+pick定理计算多边形内点数+计算多边形边上点数】

    题目:http://poj.org/problem?id=1265 Sample Input 2 4 1 0 0 1 -1 0 0 -1 7 5 0 1 3 -2 2 -1 0 0 -3 -3 1 0 ...

  8. python模块cgihttpserver启动

    cgi是web服务器运行web应用的一种机制,web服务器通过执行cgi脚本,然后将该程序的标准输出作为http响应的一部分 CGIHTTPServer是python标准模块的web服务器,它可以运行 ...

  9. shell中嵌套执行expect命令实例(利用expect实现自动登录)

    expect是 #!/bin/bashpasswd='123456'/usr/bin/expect <<EOFset time 30spawn ssh root@192.168.76.10 ...

  10. 3.django连接mysql数据库及安装mysqldb驱动报错解决办法

    1.在setting.py设置连接数据库 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'djang ...