You are not logged in. Please login at www.codechef.com to post your questions!

×

[Time limit exceeded] Lucky lucky number

can anyone please tell me why my program is exceeding it's time limit. here's the link to the solution. http://www.codechef.com/viewsolution/3117046

asked 21 Dec '13, 18:43

rahulxxarora's gravatar image

1★rahulxxarora
135
accept rate: 0%


n <= 10^9. You cannot use a loop upto 10^9 to find the ans it takes a lot of time much more then 1 sec. Also there are t <= 1000 testcases So in total 10^12. Its impossible to finish in time if you simply iterate upto n.

link

answered 21 Dec '13, 21:47

abbas's gravatar image

4★abbas
4118
accept rate: 28%

to keep number smallest, maximize digit 4, which means maximize n's divisibility by 7.

link

answered 05 Jan '14, 03:49

garakchy's gravatar image

1★garakchy
1.1k163048
accept rate: 1%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×56
×49
×19

question asked: 21 Dec '13, 18:43

question was seen: 875 times

last updated: 05 Jan '14, 03:49