aditya123garg's blog

By aditya123garg, history, 5 years ago, In English

Hey Guys, there was a question in Round 2 of the HackWithInfy Contest which I feel is quite nice and I wasn't able to think of any possible solution to it. So the question goes like that:-

We have defined a function f(x) = sum of all the digits of x. Now,

0 <= i <= N

0 <= j <= N

We have to count how many pairs are there which satisfy the condition that f(i) + f(j) is a prime.

Constraints:- 0 <= N <= 10^50

Example:-

1) N = 2

pairs = 2

2) N = 3

pairs = 4

Can anyone suggest some possible method to solve this question??

Full text and comments »

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

By aditya123garg, history, 5 years ago, In English

Hey Guys!! I have been trying to understand the Editorial's solution from quite a while now but couldn't get it properly. Can anyone please throw some light on how to proceed it.

Question link :- https://codeforces.net/contest/1163/problem/D

What I have understood till now.

At every position, we will assume every possible character to be there in the string c whenever there is asterisk present and after that, we are also maintaining what is the length of the prefix of string t and s which matches with the suffix of string c[0, i]. Now, how to move beyond this?

Additional help :-

Can someone provide some similar questions to this one which they have encountered while practicing.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By aditya123garg, history, 6 years ago, In English

Hey Guys, My solution to the third problem of yesterday's round(Educational Round 63) fails on test case 20 according to Codeforces compiler but I am getting the correct answer on my own compiler and even on dry running it by myself.

Question link :-https://codeforces.net/contest/1155/problem/C

Solution link :-https://codeforces.net/contest/1155/submission/53144801

Test case on which it is failing :

2 1 10000000000 20000000000 10000000000

Plzz Guys see to it what's happening here !!

Full text and comments »

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

By aditya123garg, history, 6 years ago, In English

Hey Guys!! Can anyone give some insights on how to approach this problem from Yesterday's contest?

Full text and comments »

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

By aditya123garg, history, 6 years ago, In English

Problem link : http://codeforces.net/contest/705/problem/C

Solution link :- http://codeforces.net/contest/705/submission/42254642

Hey guys this code is giving me the runtime error in testcase-2 on submitting it while on running the same test on my system it is giving me correct answer. I literally have no clue of what's happening :(

Could anyone plzz help me out!!

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it