Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
112363 陈昊然 数列求和 C++ Accepted 1 MS 272 KB 255 2025-03-09 13:48:42

Tests(5/5):


Code:

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