You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
300 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
//正确的代码,消除了浮点数的误差
//方法将所有数字乘10然后累加。
int main() {
int n;
double s = 0;
cin >> n;
for (int i = 1; i <= 10 * n - 1; i++) s += i;
cout << s / 10;
return 0;
}