I was really bored, and got nothing to do. Trying to read something, so I went to Gist and saw a Python script to a Project Euler problem, which I had known of for very long time, but never registered and now it seemed a great time to do so.
I actually had an account on ACM, solved some problems, long long time ago, perhaps that was the reason I was reluctant to sign up, worrying myself might get stuck in those problems, especially you spend hours and still can’t figure out how to solve it. If you are really up to challenges or learning languages, go check out ACM problem set, you will be expected to submit the code in order to solve a problem, they will compile/run the code to check the output.
Signed up an account, then started to solve the first problem. “one-minute rule” seemed quite reasonable, the code shouldn’t need much time to return an answer, however the human solving process definitely could take as long as it takes.
The first problem was actually the reason I decided to sign up, because I knew I could use Bash to solve it in quite interesting fashion. After submitted the first answer, I got this:
We hope that you enjoyed solving this problem. Please do not deprive others of going through the same process by publishing your solution outside Project Euler. If you want to share your insights then please go to thread 1 in the discussion forum.
To be perfectly frankly, I strongly disagree with that, it’s no point of avoiding putting my code somewhere in public. Cheater is always cheating, they will always find a way to get the answer. I did think about use private Gist, but no, like I said, it has no point. In fact, that would only diminish the opportunity of receiving suggestion or knowledge from others who have also solved the problem and are willing to teach you something, either the coding or the mathematics.
So, I created a Gist to store my solution codes. If you want to cheat, go ahead, no one is going to stop you. But if you notice anything flaw, please do tell me.
This is just my first solution and I think I will continue. I plan to use whatever language I see fit, as you can see me solving the first problem using Bash’s Brace Expansion, I think that’s quite creative. Maybe it’s not so efficient and that’s why I solved the same question with second method.
Although, mathematics has mostly moved out of my brain, I still remember a few things, like sum of sequence. This would probably be the only post about problems, but I might write some if I do learn something or code something interesting.
By the way, I am the 325311th person who has also solved the first problem. Also I like the Lights On/Off switch, reminds me that this blog used to have same feature.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.