mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1775.c
This commit is contained in:
parent
ca97ee504b
commit
21ec2d09cc
18
QUSTOJ/1775.c
Normal file
18
QUSTOJ/1775.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
double ans=0;
|
||||
if(n%2==1)
|
||||
{
|
||||
for(int k=1;k<=n;k+=2) ans+=1.0/k;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int k=2;k<=n;k+=2) ans+=1.0/k;
|
||||
}
|
||||
return printf("%f\n",ans),0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user