roose's blog

By roose, 10 years ago, In English

How to implement Erathostenes' sieve in O(sqrt(N)) thanks in advance.

Read more »

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

By roose, 10 years ago, In English

LUCKY 2 — Codechef

Chef loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

Let F(X) equals to the number of lucky digits in decimal representation of X. Chef wants to know the number of such integers X, that L ≤ X ≤ R and F(X) is a lucky number. Help him and calculate that number modulo 109+7.

How to Solve this problem using DP ?

Read more »

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