last day (14 days later) » 

3:03 PM
4
A: Two-Many Outputs

Stretch ManiacJava - 269 Thanks for everyone's patience, this should now be fixed. shortened: int a(int a,int b,int c){double d=180-360.0/(int)(Math.abs(Math.sin(a*60))*50+2),e=180-360.0/(int)(Math.abs(Math.cos(b*60))*50+2),f=180-360.0/(int)(Math.atan2(c*60, a*60)*51+2);if(Math.abs(d+e+f-360)<.1)return Inte...

 
Here goes nothing: 98
 
I don't think this will work, because you'll get - inside your number during concatenation (I believe that's what bitpwner is talking about). I think you can golf this down though, by not casting 360 to double but by using 360.0 instead (or maybe 360., not sure if that works in Java).
 
So, @bitpwner and I both guessed wrong?
 
@StretchManiac as long as your answer has not been cracked, you should probably just fix it (with an edit).
I get 121 outputs, but I'm not entirely sure of it.
 
Second attempt (with explicit permission): 122
If it wasn't for @MartinBüttner, I would have answered 121 as well. Then I found out that, on very rare occasions, Math.abs(Math.sin(a*60)) == 1.0. The first positive a that satisfies the condition is 152,073,634... -- +1 for making me learn Java.
 
3:03 PM
@Dennis Not bad! Did you just brute force that? Odd that this doesn't happen for cos as well then.
 
@MartinBüttner: Math.cos(0) == 1.0. I initially guessed the possible values of the trigonometric functions. Since I got 121 as the key, I ran a brute-force search to check if the sine could return 1 as well.
 
@Dennis Whoops, totally forgot about that... odd that I still got 121 without considering cos return 1.0 then.
Okay something's odd. Allowing for cos == 1.0 I get 122. also allowing for sin == 1.0 I get 123.
 
@MartinBüttner: I get 51 possible values for d and e, 160 for f. These are the 122 solutions they generate: pastebin.com/dX5ieFDw
 
@Dennis In that case, you're forgetting 1 and your answer is incorrect as well ;) (123 being correct... someone come along and grab the cracking score...). And I guess Stretch Maniac didn't account for sin == 1.0 when he said that 122 is correct.
 
Which solution seems to be missing from my list?
 
3:04 PM
1 (literally)
 
How could Integer.valueOf((int) d + "" + (int) e + "" + (int) f) give 1 if Math.abs(d + e + f - 360) < 0.1?
 
look at the code again ;)
 
/facepalm
 
there's also an else to that if
 

last day (14 days later) »