Page 1 of 1
Broken Key
Posted: Wed Dec 31, 2008 3:32 pm
by dotme
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.
Posted: Sat Jan 10, 2009 8:23 pm
by wrtlprnft
EDIT: removed because it sort of solves the follow-up challenge, broken keys (didn't know it existed, sorry)
Posted: Sun May 24, 2009 8:26 pm
by therethinker
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
Code: Select all
0<1<1-1v1-1v1^1^2?4g0<p!2?4g1<p!4c
Posted: Mon Dec 07, 2009 4:08 pm
by livinskull
therethinker wrote:I was pleasantly surprised when I found out my code worked the very first time I ran it! I couldn't believe it!
lol same here
Code: Select all
0<2>1<3>0<92*2+?1<92*?0<1-0>1<1-1>8c3<p!2<p
Posted: Sun Aug 01, 2010 12:01 pm
by arthur
My solution
Code: Select all
0<1<-0^1+99+?0^1-8?0^4?2/5c0<p!1<p!
Posted: Mon Feb 21, 2011 12:22 am
by whattheh@ck
it turns out that the HVM doesn't store decimal numbers so i just used division to see which was bigger...
Posted: Tue Mar 08, 2011 9:42 pm
by zjorzzzey
... so i just used division
Nice one!
Posted: Wed Aug 10, 2011 5:40 pm
by nuggerator
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.
Next input:
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.
Just wanted to mention, don't know if it is important.
regards
Posted: Mon Sep 19, 2011 8:55 pm
by compudemon
lol seems i got the same idea as another, hurrah division
0<1</4?0<p!1<p
Posted: Wed Oct 05, 2011 4:36 pm
by desert77
I used division too, but i considered negative numbers too...
0<1<-0^2?4g1<p!0^1+2?4g1<p!0^1^*0^2^-1^3^+/4?1<p!0<p!
Posted: Mon Jul 02, 2012 11:49 am
by exomo
My solution works on all numbers, negative, zero whatever and is not too long. So I wanted to share it:
1<0<-0^1+2/8?2/028*-g1+<p
Posted: Sun Nov 10, 2013 9:38 am
by trofi
Mine happened to be 13-ops long:
The same idea as others'.
Incomplete
Posted: Wed Nov 13, 2019 11:35 am
by yes-man
I consider the task (or more the text) to be imcomplete.
The fact that there are only positive integers should be mentioned!