Ad
  • Custom User Avatar

    It seems to be timeout

  • Custom User Avatar

    Thank you for your reply. I changed 2 lines of my code and it works now. I don't know if it is because of the difference between c++14 and c++11.

    code failed:

    bool operator<(const std::string &lhs, const std::string &rhs) {...}
    ...
    if (str1 < str2) {...}
    

    code that is accepted:

    bool less_than(const std::string &lhs, const std::string &rhs) {...}
    ...
    if (less_than(str1, str2)) {...}
    
  • Custom User Avatar

    Lang: c++ 11/14

    Expect : 311161 123053 192411 _242336 292316 90806 237453 224791 281085 39016_ 124526 226219 133683 109529 311686 245429 426860 285474 487608 497517
    Actual : 311161 123053 192411 _39016 124526 242336_ 226219 292316 90806 133683 237453 281085 224791 311686 109529 245429 426860 285474 487608 497517
    

    Look at the result above.

    • weight(242336) is 20
    • weight(39016) is 19

    So, how could 242336(20) comes before 39016(19)??

    And:

    • weight(124526) is 20
    • weight(242336) is 20

    The two numbers are equal, but how could 242336 comes before 124526?

  • Custom User Avatar

    Using a primes cache accelerates the iteration.

  • Custom User Avatar

    Isn't the isPrime function suspectable?

  • Custom User Avatar

    Hi, I use the same thought with you. But I think the result should plus one.