#45810: 西嘉嘉


chen971023@gmail.com (ZiaynGZiyaNG)

學校 : 國立臺南第二高級中學
編號 : 291750
來源 : [122.121.172.45]
最後登入時間 :
2025-10-01 23:36:53

就數學

#include <iostream>

using namespace std;

 

int main()

{

while (true)

{

int N;

cin >> N;

if (N == 0)

{

break;

}

 

cout << (N) * (N + 1) * (2 * N + 1) / 6 << endl;

 

}

}