超级简单好吧

wuzhengjie 2022-09-30 12:44:07 2022-09-30 12:44:28 16 返回题目

#include <bits/stdc++.h>

using namespace std;

int main(){

int n;

cin>>n;

double sum=0.0;

for(int i=1;i<=n;i++){

		if(i%2==1) sum+=1.0/i;

		else sum-=1.0/i;

}

cout<<fixed<<setprecision(3)<<sum;
    
    return 0;

}

{{ vote && vote.total.up }}