提交时间:2023-11-25 08:05:46
运行 ID: 111783
#include<bits/stdc++.h> using namespace std; int a[1010] = {1,2}; signed main(){ int n; scanf("%d",&n); int sum = 0; int flag = 0; for(int i = 2;i < n;i++){ sum += a[i]+a[i-1]; flag++; } if(flag == 0){ printf("%d",a[n-1]); return 0; } printf("%d",sum); return 0; }