简单的dp题

 /*
 ID: yingzho1
 LANG: C++
 TASK: money
 */
 #include <iostream>
 #include <fstream>
 #include <string>
 #include <map>
 #include <vector>
 #include <set>
 #include <algorithm>
 #include <stdio.h>
 #include <queue>
 #include <cstring>
 #include <cmath>

 using namespace std;

 ifstream fin("money.in");
 ofstream fout("money.out");

 int V, N;
 ];
 ];

 int main()
 {
     fin >> V >> N;
     f[] = ;
     ; i < V; i++) fin >> coin[i];
     ; i < V; i++) {
         for (int j = coin[i]; j <= N; j++) {
             f[j] += f[j-coin[i]];
         }
     }
     fout << f[N] << endl;

     ;
 }

USACO Section 2.3: Money Systems的更多相关文章

  1. USACO Section 1.3 题解 (洛谷OJ P1209 P1444 P3650 P2693)

    usaco ch1.4 sort(d , d + c, [](int a, int b) -> bool { return a > b; }); 生成与过滤 generator&& ...

  2. 【USACO 2.3】Money Systems(dp)

    v种货币,求有多少种组成和为n. dp[i][j]表示前i种货币价格为j有多少种方案,dp[i][j]+=dp[i-1][j-c]. http://train.usaco.org/usacoprob2 ...

  3. USACO Section 3.3: Riding the Fences

    典型的找欧拉路径的题.先贴下USACO上找欧拉路径的法子: Pick a starting node and recurse on that node. At each step: If the no ...

  4. USACO Section 3.3 Camlot(BFS)

    BFS.先算出棋盘上每个点到各个点knight需要的步数:然后枚举所有点,其中再枚举king是自己到的还是knight带它去的(假如是knight带它的,枚举king周围的2格(网上都这么说,似乎是个 ...

  5. [IOI1996] USACO Section 5.3 Network of Schools(强连通分量)

    nocow上的题解很好. http://www.nocow.cn/index.php/USACO/schlnet 如何求强连通分量呢?对于此题,可以直接先用floyd,然后再判断. --------- ...

  6. USACO Section 5.3 Big Barn(dp)

    USACO前面好像有类似的题目..dp(i,j)=min(dp(i+1,j),dp(i+1,j+1),dp(i,j+1))+1  (坐标(i,j)处无tree;有tree自然dp(i,j)=0) .d ...

  7. USACO Section 1.3 Prime Cryptarithm 解题报告

    题目 题目描述 牛式的定义,我们首先需要看下面这个算式结构: * * * x * * ------- * * * <-- partial product 1 * * * <-- parti ...

  8. USACO Section 1.1 Your Ride Is Here 解题报告

    题目 问题描述 将字符串转变为数字,字母A对应的值为1,依次对应,字母Z对应的值为26.现在有一个字符串,将其中的每个字符转变为数字之后进行累乘,最终的结果对47求余数. 题目给你两个字符串,其中的字 ...

  9. USACO Section 1.1-1 Your Ride Is Here

    USACO 1.1-1 Your Ride Is Here 你的飞碟在这儿 众所周知,在每一个彗星后都有一只UFO.这些UFO时常来收集地球上的忠诚支持者.不幸的是,他们的飞碟每次出行都只能带上一组支 ...

随机推荐

  1. android实现左右滑动菜单

    直接看效果图:       主要实现代码: package com.way.view; import android.content.Context; import android.media.Den ...

  2. 第九章 CSS-DOM

    另一个网友整理了很多书中的代码:http://www.cnblogs.com/jingangel/archive/2013/01/03/2843505.html 1. 三位一体的网页 浏览器看到的网页 ...

  3. C# Winform常见的Editor及其它经验

    1.新建一个自定义Editor,继承自.NET自带的Editor,override某些方法,再附加到属性中: public class MyCollectionEditor : CollectionE ...

  4. smaa github iryoku

    dx10 demo 这东西我没法跑nsight ...这就坑大了 里面有个 RenderTargetCollection这个东西里面有很多 rendertargets 最让我苦恼的就是 sceneRT ...

  5. 贴代码—CF230 DIV1 B

    题目在此: http://codeforces.com/contest/392/problem/B 一直理解错了一句话,以为是用最小的move求最小的花费, 读错题目的有木有!!! 不懂汉诺塔的原理有 ...

  6. [开发]Win7环境下Eclipse连接Hadoop2.2.0

    准备: 确保hadoop2.2.0集群正常运行 1.eclipse中建立mven工程,并编辑pom文件如下 <dependencies> <dependency> <gr ...

  7. 安装hbase-0.98.9-hadoop2

    1. download http://124.202.164.13/files/1244000005C563FC/www.eu.apache.org/dist/hbase/stable/hbase-0 ...

  8. 删除提示 FOREIGN KEY 约束引用”

    有时想删除某个表时,提示“无法删除对象 'Orders',因为该对象正由一个 FOREIGN KEY 约束引用”,原因很简单不要急躁,它被其它表的外键引用了,所以无法删除,在此只需先找到哪些表的外键引 ...

  9. zend studio 快捷键收集

    Ctrl + /            单行注释 Ctrl + Shift + / 添加块注释 Ctrl + Shift + \   移除块注释 Ctrl + Shift + F 调整代码格式 Ctr ...

  10. AwSnap:让全版本(Windows、iOS、Android)Chrome浏览器崩溃的有趣漏洞

    彩蛋爆料直击现场 几周前,我们曾报道了13个字符导致Chrome崩溃的漏洞.然而,这个漏洞有个小小的遗憾,那就是它只在MAC OS X下生效,其他系统并不受影响. 现在,我们又有了一个更有趣的漏洞.黑 ...