Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
46389 | 杨中琦 | 编程求1+1/2+1/3+...+1/n | C++ | Accepted | 100 | 0 MS | 256 KB | 165 | 2022-07-13 12:55:38 |
#include<iostream> int main(){ int a,b=0,d; float c; scanf("%d",&a); d=a; while(b<a){ c=c+1.0/d; b++; d--; } printf("%.3f",c); return 0; }