1 solutions
-
0
C++ :
#include <iostream> using namespace std; int main(){ int i = 1,n,x; double s = 0; cin>>x; while(s <= x){ s = s + 1.0 / i; i++; } cout<<i - 1<<endl; return 0; }Python :
x = int(input()) s = 0 i = 1 while True: s += 1 / i if s > x: print(i) break i += 1
- 1
Information
- ID
- 810
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By