文章

7

粉丝

94

获赞

7

访问

3.9k

头像
不连续1的子串 题解:
P1726 中山大学2019年机试题
发布于2023年7月20日 21:37
阅读数 324

#include <bits/stdc++.h>
using namespace std;
const int maxn=25;
long long dp[maxn];
int main(){
    int N; 
    cin>>N;
    dp[1]=2;
    dp[2]=3;
    for(int i=3;i<=N;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    cout<<dp[N]<<endl;
    return 0;
}

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发