fork download
  1. #include <iostream>
  2. #define VERSION "100"
  3. constexpr int const_atoi(const char* num, int accum=0) {
  4. return *num ? const_atoi(num+1, accum*10 + (*num - '0')) : accum;
  5. }
  6.  
  7. template<bool V_GT_100> class MoreOrLess_Impl;
  8. template<> class MoreOrLess_Impl<false> {
  9. public:
  10. // Old prototype
  11. static int doit(double x) { return x; }
  12. };
  13.  
  14. template<> class MoreOrLess_Impl<true> {
  15. public:
  16. // New prototype
  17. static uint64_t doit(long double x) { return x; }
  18. };
  19. using MoreOrLess = MoreOrLess_Impl<(const_atoi(VERSION) > 100)>;
  20.  
  21. int main() {
  22. long double a;
  23. std::cin >> a;
  24. std::cout << MoreOrLess::doit(a) << std::endl;
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0s 3432KB
stdin
1000000000003
stdout
-2147483648