Broken Key
Broken Key
Hmm, I expected this to be harder.
My 1st idea was to decrement both values in a loop and break out when the first number falls to zero. But before testing this solution I thaught about the cycle limit and potentially negative values and discarded that idea.
But as I didn't had an idea how to test for signedness with the limited instruction set, I tried my first idea.
Fortunately, it seems that the solution isn't tested with big or negative values.
My 1st idea was to decrement both values in a loop and break out when the first number falls to zero. But before testing this solution I thaught about the cycle limit and potentially negative values and discarded that idea.
But as I didn't had an idea how to test for signedness with the limited instruction set, I tried my first idea.
Fortunately, it seems that the solution isn't tested with big or negative values.
-
- Posts: 144
- Joined: Fri Mar 28, 2008 11:29 pm
- Location: #hacker.org on Freenode
I was pleasantly surprised when I found out my code worked the very first time I ran it! I couldn't believe it!
Its not great code, but it's easy to follow
Its not great code, but it's easy to follow
Code: Select all
0<1<1-1v1-1v1^1^2?4g0<p!2?4g1<p!4c
- livinskull
- Posts: 22
- Joined: Fri Jun 26, 2009 12:01 pm
- Location: /dev/null
- Contact:
lol same heretherethinker wrote:I was pleasantly surprised when I found out my code worked the very first time I ran it! I couldn't believe it!
Code: Select all
0<2>1<3>0<92*2+?1<92*?0<1-0>1<1-1>8c3<p!2<p
My solution
Code: Select all
0<1<-0^1+99+?0^1-8?0^4?2/5c0<p!1<p!
-
- Posts: 16
- Joined: Wed Jul 16, 2008 2:33 am
- Location: here
it turns out that the HVM doesn't store decimal numbers so i just used division to see which was bigger...
Code: Select all
0<1</4?0<p!1<p!
hack the planet
-
- Posts: 3
- Joined: Tue Jun 28, 2011 12:37 pm
- Location: Germany
Code: Select all
Warning: Division by zero in /home/hacker_apache/html/hacker/html/hvm/hvmchallenge.php on line 88
17 test(s) passed
'0<1<-0^0^*/4?1<p!0<p' is incorrect.
Code: Select all
0<1<-0^1-26*?0^0^*/4?1<p!0<p
Code: Select all
Warning: Division by zero in /home/hacker_apache/html/hacker/html/hvm/hvmchallenge.php on line 88
'All tests passed' is correct.
regards
-
- Posts: 33
- Joined: Sat Aug 13, 2011 2:13 pm
Mine happened to be 13-ops long:
The same idea as others'.
Code: Select all
0<1<0<1</1?dp
Incomplete
I consider the task (or more the text) to be imcomplete.
The fact that there are only positive integers should be mentioned!
The fact that there are only positive integers should be mentioned!