ZJANS

a044. 空間切割

Hard Last Update: 2025/05/16
數學

給一正整數 n
求空間中的 n 個平面最多可將空間切成幾個區域


解法一、數學

✅ 完整代碼

評分結果(參考) : AC (3ms, 340KB)

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    while(cin >> n) cout << n*(n*n+5)/6 + 1 << "\n";

    return 0;
}