Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
5889 吴泽宇 上楼梯 C++ Compile Error 0 0 MS 0 KB 339 2020-08-16 08:50:48

Tests(0/0):


#include<bits/stdc++.h> using namespace std; int k[INT_MAX]={0}; int upstair(int stairs){ if(stairs<=1)return 1; if(k[stairs]==0)return k[stairs]; k[stairs]=upstair(stairs-1)+upstair(stairs-2); return k[stairs]; } int main(){ int n; cin>>n; while(n--){ int a; cin>>a; cout<<upstair(a)<<endl; } return 0; }


Judgement Protocol: