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.
22 lines
506 B
22 lines
506 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
ios::sync_with_stdio(false); //读入输出优化的强迫症
|
|
int n, m;
|
|
int num = 0;
|
|
//设置输出为小数点后5位
|
|
cout << fixed << setprecision(5);
|
|
while (true) {
|
|
cin >> n >> m;
|
|
num++;
|
|
if (n == 0 && m == 0) break;
|
|
double sum = 0.0;
|
|
for (int i = n; i <= m; i++) {
|
|
sum += 1 / pow(i, 2);
|
|
}
|
|
cout << "Case "<<num<<":"<<sum << endl;
|
|
}
|
|
return 0;
|
|
} |