Aditya_Sharma's blog

By Aditya_Sharma, history, 3 years ago, In English

Hi everyone.

JUST COMMENT CODE EDITOR USED BY YOU IN THE COMMENT SECTION.

I promise to come up with results IN 2 DAYS.

Full text and comments »

  • Vote: I like it
  • -22
  • Vote: I do not like it

By Aditya_Sharma, history, 3 years ago, In English

Can someone tell all important algorithms and all important concepts required for COMPETITIVE PROGRAMMING...

There is a great need for some guidance...I googled it but it tells the things that I already know. Thanks to all in advance. All comments are invited. Anyone can post any informative link.

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it

By Aditya_Sharma, history, 3 years ago, In English

[problem:1420 D] I dont know how to calculate N(c,r) by LOGIC applied in given below Mod_Inverse FUNCTION. Without this logic, this problem can't be solved. In the below code all factorials were precalculated till 3e6.
Tell me what problem was there in directly doing n! / ( r! * (n-r)! )....instead of using Mod_Inverse FUNCTION ...

((below code is not my code . I have got it from submissions.))

below is a code segment only to calculate N(c,r)...

(((( Fact[i] means (factorial i) or i! ))))

ll NCR (ll n, ll r, ll p)
{
   if (r == 0)
   {
      return 1;
   }
   return  (( Fact[n] * Mod_Inverse(Fact[n - r], p) ) % p  *  Mod_Inverse(Fact[r], p) ) % p ;
}
 
ll Mod_Inverse(ll a, ll m)
{
   // m is  A prime NUMBER.
   return Fast_Mod(a, m - 2, m);
}

ll Fast_Mod(ll a, ll b, ll m) 
{
    ll Result = 1;

    while (b > 0) 
    {
       if (b & 1)
       Result = (Result * a) % m;

       a = (a * a) % m;
       b = b >> 1;

    }

     return Result;
}

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it

By Aditya_Sharma, history, 4 years ago, In English

You need to have a lot of patience when you start your coding journey. At first,you need to learn basics like for loops,basic math etc. After 6 months you need to start solving questions on code-forces and other platforms. You need to have a lot of patience in order to increase ratings. It is a long process. First solve easy problems then increase levels, 1 step at a time.

After learning basics of a language like c++(preference) or any other language ,you need to start learning data structures topic wise. Again you need to give time to each topic. Then after many days you will self realize that you have come a long way ahead .

Full text and comments »

  • Vote: I like it
  • -47
  • Vote: I do not like it