b558. 求數列第 n 項

解法一

✅ 完整代碼

評分結果(參考) : AC (2ms, 348KB)

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    while(cin >> n){
        cout << 1+(n-1)*n/2 << "\n";
    }
    
    return 0;
}