Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <queue>
- #include <iostream>
- #include <vector>
- #include <cstring>
- #include <iostream>
- #include <set>
- #include <cstring>
- #include <stack>
- #include <algorithm>
- #include <map>
- #include <cmath>
- //#include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- const int maxn = 3e5 + 10;
- const ll INF = 3e16 + 10;
- string int_to_string(int x) {
- string res = "";
- while(x) {
- res += (x % 10) + '0';
- x /= 10;
- }
- reverse(res.begin(), res.end());
- return res;
- }
- int main() {
- ios_base::sync_with_stdio(false);
- string s;
- cin >> s;
- int fact = 1;
- map<string, int> mapa;
- for(int i = 1; i <= 10; i++) {
- fact *= i;
- mapa[int_to_string(fact)] = i;
- }
- if(mapa.count(s)) {
- cout << mapa[s] << endl;
- return 0;
- }
- double sum = 0;
- double sz = s.size();
- for(double i = 1; i <= 1000000; i += 1.0) {
- sum += log10(i);
- if(fabs(sz - sum) < 1.0) {
- cout << i << endl;
- return 0;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement