1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#include <iostream> #include <iomanip> using namespace std; int main() { int n,m; double sum; while(1) { cin >> n; cin >> m; sum = 0; if(cin.eof()) { break; } for(int i = m+1 ; i < n+1 ; i++) { sum += 1.0/i; } cout << fixed << setprecision(10) << sum << endl; } return 0; }