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

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. answered 21 Dec '13, 21:47

to keep number smallest, maximize digit 4, which means maximize n's divisibility by 7. answered 05 Jan '14, 03:49
