哪位能帮我看一下代码?

#include <bits/stdc++.h>
using namespace std;
int main(){
    int k;
    cin>>k;
    int Sn=1,n=2;
    while(Sn<=k){
        Sn=Sn+1/n;
        n++;
    }
    cout<<n;
    return 0;
}

http://ybt.ssoier.cn:8088/problem_show.php?pid=1087

#include <bits/stdc++.h>
using namespace std;
int main(){
    int k;
    cin>>k;
    double Sn=1;
    int n =1;
    while(Sn<=k){
        n++;
        Sn=Sn+1.0/n;
    }
    cout<<n;
    return 0;
}