P6205 [USACO06JAN]Dollar Dayz S

Aimee

他的状态转移有手就行

但是需要写高精

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<bits/stdc++.h> 
using namespace std;
struct Aimee{
    int len;
    int a[1001];
}f[1001];
int n,k;
Aimee  operator + (const Aimee &x,const Aimee &y){
    Aimee tem;
    int l=max(x.len,y.len);
    int u=0;
    for(int i=1;i<=l;++i){
        tem.a[i]+=x.a[i]+y.a[i];
        tem.a[i+1]+=(tem.a[i]/10);
        tem.a[i]%=10; 
    }
    if(tem.a[l+1]!=0){
        tem.len=l+1;
    }else{
        tem.len=l;
    }
    return tem;
}
void Ar(){
    for(int i=f[n].len;i;--i){
        cout<<f[n].a[i];
    }
}
int main(){
    scanf("%d%d",&n,&k);
    f[0].len=1;
    f[0].a[1]=1;
    cout<<f[10].len<<endl;
    for(int i=1;i<=k;++i){
        for(int j=i;j<=n;++j){
            f[j]=f[j]+f[j-i];
        }
    }
    Ar(); 
    return 0;
}
暂无评论

发送评论 编辑评论


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