注:此题简单直接上代码
#include <iostream>
using namespace std;
int main() {
int sum = 0, psum = 0;
for (int i = 1; i <= 100; i++) {
sum += i;
psum += i * i;
}
cout << sum * sum - psum << endl;
return 0;
}
欢迎码友讨论
注:此题简单直接上代码
#include <iostream>
using namespace std;
int main() {
int sum = 0, psum = 0;
for (int i = 1; i <= 100; i++) {
sum += i;
psum += i * i;
}
cout << sum * sum - psum << endl;
return 0;
}
欢迎码友讨论