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

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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;
}