George_153 @ 2024-10-02 09:46:36
#include<iostream>
using namespace std;
int main()
{
int i,n,s;
cin>>n;
int w=0;
for(i=1;i>=n;i++)
{
s=1/i;
w=w+s;
}
w=w+1;
cout<<w;
return 0;
}
by geyuzhen @ 2024-10-02 09:59:46
超时了
by yzdcde @ 2024-10-02 10:13:53
int类型只能存整数,存小数要用double或float