UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#148314#4. 爬楼梯littlefox1000ms1168kbC++111.9kb2022-06-11 15:06:332022-06-11 15:06:34

answer

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <queue>
#include <bitset>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <cstdlib>
#include <unordered_map>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/hash_policy.hpp>
using namespace __gnu_pbds;
#define mp make_pair
#define lson tr[now].ls
#define rson tr[now].rs
#define pb push_back
#define debug() cout<<"qwq"<<endl
#define mem(i,a) memset(i,a,sizeof(i))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
#define i128 __int128
#define pii pair<int,int>
const db eps=1e-10;
const ll INF = 0x3f3f3f3f;
const int siev =1000000+5;
const int inf = 0x3f3f3f3f;
const int DMAX = 100 + 100;
const ll MOD = 32768;
const ll LMOD = 1000000007;
const int hmod = 202010923;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
template<class T> inline void print(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    int a[20];
    int cnt=0;
    do{
        a[++cnt]=x%10;
        x/=10;
    }while(x>0);
    for(int i=cnt;i>=1;i--){
        putchar(a[i]+'0');
    }
    putchar('\n');
    // puts("");
}
template<class T> inline void read(T &x){
    x=0;
    T f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-'){
            f=-1;
        }
        ch=getchar();
    }
    while(ch<='9' && ch>='0'){
        x=x*10+(ch-'0');
        ch=getchar();
    }
    x*=f;
}
int T;
int n;
ll dp[DMAX];
int main(){
    dp[1]=1,dp[2]=2;
    for(int i=3;i<=45;i++){
        dp[i]=dp[i-1]+dp[i-2]; 
    }
    read(T);
    cout<<dp[T]<<endl;
    return 0;
    while(T--){
        read(n);
        cout<<dp[n]<<" ";
    }
    cout<<endl;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

36

output:

24157817

result:

ok 1 number(s): "24157817"

Test #2:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

30

output:

1346269

result:

ok 1 number(s): "1346269"

Test #3:

score: 10
Accepted
time: 0ms
memory: 1168kb

input:

29

output:

832040

result:

ok 1 number(s): "832040"

Test #4:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

21

output:

17711

result:

ok 1 number(s): "17711"

Test #5:

score: 10
Accepted
time: 0ms
memory: 1168kb

input:

16

output:

1597

result:

ok 1 number(s): "1597"

Test #6:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

12

output:

233

result:

ok 1 number(s): "233"

Test #7:

score: 10
Accepted
time: 0ms
memory: 1168kb

input:

9

output:

55

result:

ok 1 number(s): "55"

Test #8:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

5

output:

8

result:

ok 1 number(s): "8"

Test #9:

score: 10
Accepted
time: 0ms
memory: 1168kb

input:

4

output:

5

result:

ok 1 number(s): "5"

Test #10:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

1

output:

1

result:

ok 1 number(s): "1"