D - 88888888 (AtCoder Beginner Contest 357)

Code: atcoder.jp/contests/abc357/su...
Binary Exponentiation: www.geeksforgeeks.org/binary-...
Modular division: discuss.codechef.com/t/guide-...
#atcoder #codechef #codeforces #arc #cp #abc #Atcoder

Пікірлер: 7

  • @helpingcoder1910
    @helpingcoder1910Ай бұрын

    👍

  • @solvinglife6658
    @solvinglife6658Ай бұрын

    Cfbr

  • @thequacker6504
    @thequacker6504Ай бұрын

    the code you have provided has used (n*s) while calculating the power which will overflow in cpp but gets accepted in python but in cpp to do binary exponentiation of (10,n*s) we will have to use euler totient function of mod

  • @soumyabhattacharjee1051

    @soumyabhattacharjee1051

    Ай бұрын

    Not necessarily, 2 tricks you can use for the given constraints. Unsigned long long instead of long long to store r=10^s, and then you can use (r^n-1)/(r-1). You can check my code atcoder.jp/contests/abc357/submissions/54462244. Please like and subscribe if it is helpful

  • @thequacker6504

    @thequacker6504

    Ай бұрын

    @@soumyabhattacharjee1051 got it thanks! Subscribed!

Келесі