Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
112408 刘慕莀 上台阶 C++ Accepted 1 MS 268 KB 250 2025-03-09 14:09:43

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; long long a[51]; int main(){ int n; cin >> n; a[1] = 1; a[2] = 2; a[3] = 4; for(int i = 4;i <= n;i++){ a[i] = a[i-1]+a[i-2]+a[i-3]; } cout << a[n]; return 0; }