7546 金币数量
#include<bits/stdc++.h> #define f(i,s,e) for(int i = s; i <= e; i++) #define ll long long using namespace std; const int N = 1e3+10,inf = 0x3f3f3f3f; int main() { int n,sum = 0,g = 0; cin >> n; for(int i = 1; i <= n; i++) { g += i; //金币每层都会加i sum += g; //累加金币 } cout << sum; return 0; }