Перевидите на c++ . n,n1,i,j: integer; s,k,c: int64; begin readln(n); s: =0; for i: =1 to n do begin read(n1); c: =1; k: =0; for j: =2 to n1 do begin k: =k+c; inc(c); end; s: =s+k; end; writeln(s); readln; readln; end.
int main() { short int n, n1, i, j; long long int s, k, c;
std::cin >> n; s = 0; for (i = 1; i <= n; i++) { std::cin >> n1; c = 1; k = 0; for (i = 2; i <= n1; i++) { k += c; c++; } s += k; } std::cout << s << std::endl; std::cin.get(); return 0; }
int main() {
short int n, n1, i, j;
long long int s, k, c;
std::cin >> n;
s = 0;
for (i = 1; i <= n; i++) {
std::cin >> n1;
c = 1;
k = 0;
for (i = 2; i <= n1; i++) {
k += c;
c++;
}
s += k;
}
std::cout << s << std::endl;
std::cin.get();
return 0;
}