提交时间:2024-01-26 09:49:57

运行 ID: 128797

#include<bits/stdc++.h> #define int long long using namespace std; int dp[205]; signed main(){ ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); int n; cin>>n; dp[1] = 2; cout<<"2 "; for (int i = 2;i <= n;i++){ if (i & 1){ dp[i] = dp[i - 1] + 3; } else{ dp[i] = dp[i - 1] - 1; } cout<<dp[i]<<' '; } return 0; }