Sort by

recency

|

29 Discussions

|

  • + 0 comments
    from itertools import product
    def one(n,m):
      for tup in product('1',repeat=n):
        s=''.join(tup)
        i=int(s)
        if i%m==0:
          print(i-int(i/m)*m)
    
          
    print(one(3,3))
    
  • + 0 comments

    I tried this : 1/ find a diviser to n (call it n1) then the original number 111...11 can be divided by n1, and the result is like n2=1000...1000...1 (number of zeros dpend on n1) then our original number 111...11 (n ones) = 11..1 (n1 ones)n2 Now 1000...1000....1 = 1000...1000...0 +1 1000...1000...0 can be divided by 1000... one can continue like this with some patterns to reduce the cost of % big numbers But it didn't run all test cases :/ time exceeded

  • + 0 comments

    If your C++ code fails last test ,try using __int128_t.

  • + 0 comments

    This is a pretty fun problem.

    We can see that 111...N times mod m = (999.. N times mod 9m) / 9 by mod distributive law

    999.. N times mod 9m can be calculated efficiently with binary exponentiation, it is 10^N - 1, and the 10^N can be calculated in log N time.

    Now when do I get a gf.....

  • + 0 comments

    You know, I have long dreamed of finding myself an Asian girlfriend and I succeeded. A couple of months ago I was browsing the internet and found a dating site https://www.onenightfriend.com/asian-hookup.html which helped me solve my loneliness problem. I just registered and started chatting, but I was serious and now I have a gorgeous girl from China.