【題解】ZeroJudge c024: 10079 – Pizza Cutting Posted on: 2019-12-01 | By: YuiHuang 1 + 1 + 2 + 3 + … + N = 1 + N*(N+1) / 2數字很大,要宣告long long #include <iostream> using namespace std; int main() { long long n; while (cin >> n){ if (n < 0) break; cout << n * (n+1) / 2 + 1 << endl; } return 0; } Post Views (since April 2021) : 542 分享本文 Share with friends