Solution for Net-Force.nl : Level 601 - Keep walking...
This is the link to the original challenge: http://www.net-force.nl/challenge/level601/
Quest:
This is a challenge to test your basic programming skills.
Pseudo code:
Set X = 1
Set Y = 1
Set previous answer = 1
answer = X * Y + previous answer + 3
After that => X + 1 and Y + 1 ('answer' becomes 'previous answer') and repeat this till you have X = 525.
The final answer is the value of 'answer' when X = 525. Fill it in below to check if it's the correct answer. If it is, you will get the password for the challenge page.
Example:
Pseudo code:
Set X = 1
Set Y = 1
Set previous answer = 1
answer = X * Y + previous answer + 3
After that => X + 1 and Y + 1 ('answer' becomes 'previous answer') and repeat this till you have X = 525.
The final answer is the value of 'answer' when X = 525. Fill it in below to check if it's the correct answer. If it is, you will get the password for the challenge page.
Example:
5 = 1 * 1 + 1 + 3
12 = 2 * 2 + 5 + 3
24 = 3 * 3 + 12 + 3
........................
........................
Since this is a programming challenge, let's look at the clues given to us.
Set X = 1
Set Y = 1
Set previous answer = 1
answer = X * Y + previous answer + 3
So we need 3 variables, x, y and answer as we can reuse "answer" as "previous answer". This will translate to something like the following.
x=1
y=1
answer = 1
answer = x * y + answer + 3
Based on the hints given, i've finally code an python script that gave me the answer.
import os, sys
def main():
x=1
y=1
answer = 1
for z in range(0,525):
answer = x * y + answer + 3
x+=1
y+=1
if x==524:
print("\nprevious answer = %d") % (answer)
print("\nx=%d, y=%d\nanswer = %d") % (x,y,answer)
if __name__ == '__main__':
main()
Running my own script, i got back this:
previous answer = 47823644
x=526, y=526
answer = 48373851
Entering the answer in the challenge page and we smelled success again.
Cheers
0x4A61636F62
No comments:
Post a Comment