P1474 [USACO2.3]Money System / [USACO07OCT]Cow Cash G

[Aimee](https://www.luogu.com.cn/problem/P1474

显然是个背包

#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
int n,v;
int f[100001];
int znx[1000001];
signed main(){
    scanf("%d%d",&n,&v);
    for(int i=1;i<=n;++i)
        scanf("%d",&znx[i]);
    f[0]=1;
    for(int j=1;j<=n;++j)    {
        for(int i=1;i<=v;++i){
            if(znx[j]<=i){
                f[i]+=f[i-znx[j]];
            }
        } 
    //  cout<<f[i]<<" ";
    }
    cout<<f[v];
    return 0;
}
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇