What is the sum of the digits of the decimal form of the number represented by brain teaser 23/16/2024 I found here that if n > 5, then 9 divides sum of digits of a factorial. As mquander said, there should be a clever solution, without bugnum, with just plain Pascal code, couple of loops, O(n 2) or something like that. We were 16 at that time so it should not be a "rocket science".ĭoes anyone know what kind of an algorithm he could use?ĮDIT: I'm sorry if I didn't made the question clear. I believe it was some sort of dynamic programming, or something from number theory. It was a hack, but it worked.īut there was a guy, who solved this problem with about 10 lines of code and it would give an answer in no time. It built an array of pre-calculated values which I could use in my code. My solution was pretty fast but not fast enough, so I just let it run for some time. I think there was up to 100 numbers for each test set. I was on a programming contest back in 2004, and there was this problem: I just thought that someone might know a real solution to this problem.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |