[CSES][Mathematics] Sum of Divisors

Поделиться
HTML-код
  • Опубликовано: 26 дек 2024

Комментарии • 29

  • @parthpawar7837
    @parthpawar7837 3 года назад +10

    Whenever I'm stuck on a CSES problem, I know ARS will be there with an easy explanation! Thank you for making CSES video editorials. (Also I believe you're secretly a master on CF)

    • @neatlystructured
      @neatlystructured  3 года назад +2

      Thank you so much! I really appreciate your support!

  • @x_x3557
    @x_x3557 3 года назад +2

    Brilliant explanation! I'm really grateful that you put that extra effort to explain how to use modulo during division, others would explain the problem and skip the modulo part assuming we already know. Thanks to you now I know the right way to take mod during division!! XD

    • @neatlystructured
      @neatlystructured  3 года назад +1

      So glad i could help, it's people like you who make this effort worthwhile!

  • @competitiveprogramming316
    @competitiveprogramming316 3 года назад +7

    Bro this question look very simple by its name but this approach is little hard to think... How you think and understand these solutions and concept.. Your explanation is amazingggg 😍

    • @neatlystructured
      @neatlystructured  3 года назад +8

      It is perfectly normal that this approach seems a bit hard. The most important thing in cp is to enlarge one's database of problems and techniques. What you learned from this problem can come in handy in similar situations, and be sure that all competitive programmers learn from others to a great extent and very rare are the occasions when one comes with smtg truly original.

  • @raghavendrac4710
    @raghavendrac4710 7 месяцев назад

    Great explanation. Thank you!!

  • @vba_sunny246
    @vba_sunny246 23 дня назад

    So Good!

  • @aayushsharma5133
    @aayushsharma5133 3 года назад +1

    superb!!!!

  • @koushikbiswas8289
    @koushikbiswas8289 3 года назад +2

    I have one doubt-
    Formula of calculating sum of n numbers is (n*(n-1))/2.
    Then when we calculating sum of (j-1) values, why we are doing (j*(j-1))/2 , instead of (j-1 * ((j-1)-1))/2 ?????

    • @neatlystructured
      @neatlystructured  3 года назад +1

      Actually the formula of calculating sum of n numbers is (n*(n+1))/2. For example sum up to 3 will be 6 but (3*2)/2 is only 3 whereas (3×4)/2 is 6

  • @Manishkumar-mw2zw
    @Manishkumar-mw2zw Год назад

    nice explaination

  • @luismiguelbaezaponte9208
    @luismiguelbaezaponte9208 2 года назад +1

    I know that this trick comes from The Harmonic Lemma but, does it have a known name or with which I can identify it?

  • @itssidhere
    @itssidhere 2 года назад +1

    This approach is giving TLE. Instead of multiplying with the modular inverse we can multiply with (MOD+1)/2

    • @neatlystructured
      @neatlystructured  2 года назад +1

      As you saw in the video! this approach got accepted! can you share your submission?

    • @todaytech7011
      @todaytech7011 Год назад

      @@neatlystructured you calculate modular binary exponent every loop iteration which is constant so store it in variable and use it for each test case

  • @AjeetGupta-c4z
    @AjeetGupta-c4z Год назад

    what is the logic behind j= n/q+1 ?

  • @shreyashachoudhary480
    @shreyashachoudhary480 2 года назад +1

    Thanks!

  • @competitiveprogramming316
    @competitiveprogramming316 3 года назад +2

    Bro can you give some hints for this question
    We are given N numbers in an array, find a minimum number (say P) which is co-prime with all numbers of array

    • @neatlystructured
      @neatlystructured  3 года назад

      I am not sure i understand this problem correctly because 1 seems to be an answer always. But i dont think that s what s required

    • @competitiveprogramming316
      @competitiveprogramming316 3 года назад

      @@neatlystructured bro here array of n elements are given.. It doesn't mean we have to find from 1 to n

    • @competitiveprogramming316
      @competitiveprogramming316 3 года назад

      @@neatlystructured yes problem is very confusing

    • @neatlystructured
      @neatlystructured  3 года назад

      @@competitiveprogramming316 can you share the link to the problem?

  • @hariomsingh2380
    @hariomsingh2380 3 года назад +2

    still i get tle in this question

    • @neatlystructured
      @neatlystructured  2 года назад

      Can you share your code please?

    • @todaytech7011
      @todaytech7011 Год назад

      ​@@neatlystructured you calculate modular binary exponent every loop iteration which is constant so store it in variable and use it for each test case

    • @AdityaVikramSomvanshi
      @AdityaVikramSomvanshi 11 месяцев назад

      take const ll mod=1e9+7 It might work