P2736 [USACO3.4]“破锣摇滚”乐队 Raucous Rockers

P2736 [USACO3.4]“破锣摇滚”乐队 Raucous Rockers

死小的数据范围

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,m,t;
int a[50001];
int ans=0;
void dfs(int ncd,int ns,int re,int ch){
    if(ncd==m+1||ns>n){
        ans=max(ch,ans);
        return ;
    }
    if(ch==n){
        cout<<n;
        exit(0);
    }
    if(re>=a[ns]){
        dfs(ncd,ns+1,re-a[ns],ch+1);
    }else{
        dfs(ncd+1,ns,t,ch);
    }
    dfs(ncd,ns+1,re,ch);
}
int main(){
    scanf("%d%d%d",&n,&t,&m);
    for(int i=1;i<=n;++i){
        scanf("%d",&a[i]); 
    } 
    dfs(1,1,t,0);
    cout<<ans<<endl;
    return 0;
}
暂无评论

发送评论 编辑评论


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