fork download
  1. #pragma GCC optimize("02,unroll-loops")
  2. #pragma GCC target("avx2,fma")
  3. #include<iostream>
  4. #include <sstream>
  5. #include <iomanip>
  6. #define inout() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  7. #define el cout << '\n'
  8. #define fi first
  9. #define se second
  10. #define pb push_back
  11. #define pf push_front
  12. #define ll long long
  13. #define N 100000
  14. #define sz(x) (x).size()
  15. #define all(v) (v).begin(), (v).end()
  16. #define FOR(a,b,c) for(int a=b;a<=c;++a)
  17. #define FORE(a,b,c) for(int a=b;a>=c;--a)
  18. #define __Art__ signed main()
  19. #define NAME "sor"
  20. using namespace std;
  21. void sol(){
  22. long double k[] = {0.0, 10.0, 5.0, 10.0, 5.0, 2.0, 5.0, 10.0, 5.0, 10.0};
  23. long double l;
  24. cin >> l;
  25. if ((int)l == l) return cout << 1, void();
  26. ostringstream oss;
  27. oss << setprecision(19) << l;
  28. string a = oss.str();
  29. int r = 1;
  30. while (a[sz(a) - 1] == '0') a.erase(sz(a) - 1, 1);
  31. while (1){
  32. if ((int) l == l) return cout << r, void();
  33. l *= k[a[sz(a) - 1] - 48];
  34. r *= k[a[sz(a) - 1] - 48];
  35. oss << setprecision(19) << l;
  36. a = oss.str();
  37. while (a[sz(a) - 1] == '0') a.erase(sz(a) - 1, 1);
  38. }
  39. }
  40. __Art__{
  41. if (fopen(NAME".INP", "r")) {
  42. freopen(NAME".INP", "r", stdin);
  43. freopen(NAME".ANS", "w", stdout);
  44. }
  45. inout();
  46. int t = 1;
  47. //cin >> t;
  48. while (t--) sol();
  49. return (0 ^ 0);
  50. }
  51.  
Success #stdin #stdout 0s 5312KB
stdin
1.23
stdout
100