1 solutions
-
0
C++ :
#include<bits/stdc++.h> using namespace std; long long n,L=1,R,M; long long check(long long x) { return trunc(log(x)/log(10)*x)+1; } int main() { cin>>n;R=n; while(L<=R) { M=(L+R)/2; if(check(M)>=n)R=M-1; else L=M+1; } cout<<L; return 0; }Pascal :
program p1003; var m,n,l,r:longint; Function check:boolean; Begin m:=(l+r) shr 1; if (m*ln(m)/ln(10))>=n-1 then exit(true) else exit(false); End; begin Readln(n); L:=1; r:=200000000; While l<>r do If check then r:=m else l:=m+1; Writeln(l); End.
- 1
Information
- ID
- 17151
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By