37
4
Note: This is the cops' thread, where one should post the scrambled code. Here is the robbers' thread where the cracked source should be posted and linked to the cop's answer.
Task: Write the shortest safe program which multiplies the square root of an integer n by the square of n
This is cops-and-robbers, so the rules are:
- In your answer, post a scrambled version of your source code (the characters should be written in any order). The scrambled version should not work!
- You can take input in any standard way, the same goes for output. Hardcoding is forbidden
- After the code is cracked by the robbers (if this happens), you must mention that your code has been cracked in your title and add a spoiler to your answer's body with your exact code
- The same applies to safe answers (mention that it's safe and add the spoiler)
- The code is considered safe if nobody has cracked it in 5 days after posting it and you can optionally specify that in the title
- You must specify your programming language
- You should specify your byte count
- You must state the rounding mechanism in your answer (see below)
You can assume that the result is lower than 232 and n is always positive. If the result is an integer, you must return the exact value with or without a decimal point; otherwise the minimum decimal precision will be 3 decimal places with any rounding mechanism of your choice, but can include more. You must state the rounding mechanism in your answer. You are not allowed to return as fractions (numerator, denominator pairs - sorry, Bash!)
Examples:
In -> Out
4 -> 32.0 (or 32)
6 -> 88.18163074019441 (or 88.182 following the rules above)
9 -> 243.0
25 -> 3125.0
The shortest safe answer by the end of April will be considered the winner.
2Related. (Same CnR rules, different task.) – Martin Ender – 2017-04-03T12:57:21.840
2@MartinEnder If the task is the only thing differing, then isn't it a duplicate? – Nathan Merrill – 2017-04-03T14:48:24.860
1@NathanMerrill I don't know, I don't think we have any established duplicate guidelines for cops and robbers challenge, but if I ask a new [tag:code-golf] challenge, where the "only" thing that's different from a previous code golf is the task, it's usually not considered a duplicate. ;) (That said, I agree that CnRs are probably more interesting if we change up the CnR-part of the challenge, not the underlying task.) – Martin Ender – 2017-04-03T14:50:32.230
@MartinEnder I personally think that the answers from the other challenge could be trivially modified to fit this challenge. It has nothing to do with the tag IMO – Nathan Merrill – 2017-04-03T14:53:55.353
@NathanMerrill I don't know about others, but none of my four answers could be reasonably reused for this challenge. – Martin Ender – 2017-04-03T14:56:21.300
1Good luck everyone! I am really glad that you have decided to reopen this. Looking forward to see interesting answers! – Mr. Xcoder – 2017-04-03T15:23:43.713
Is it okay if for large values there are rounding errors due to the inaccuracy of floating point numbers at that size? – fəˈnɛtɪk – 2017-04-03T15:56:11.860
@fəˈnɛtɪk yes, of course. The decimal precision really shouldn't matter that much for large values – Mr. Xcoder – 2017-04-03T15:57:03.023
Max expected input is 7131.55. It might be helpful to have that in the post. – fəˈnɛtɪk – 2017-04-03T16:17:48.217
I mentioned that the result is lower than 2^32, so I think it is not necessary @fəˈnɛtɪk – Mr. Xcoder – 2017-04-03T16:18:42.040
2I had written my code to work for an input up to 2^32... Which is why I asked about rounding errors, got rather off the mark at that point – fəˈnɛtɪk – 2017-04-03T16:19:16.857
Do the robbers need to use the same rounding method as the cops? – Leo – 2017-04-03T16:46:25.840
Not necessarily, as long as it works @Leo – Mr. Xcoder – 2017-04-03T16:47:43.953
Can languages that do not natively support decimal numbers (Brainfuck, as an example) support only Integer output? – ATaco – 2017-04-04T01:33:20.773
Well, that's kind of unfair @ATaco, but I will accept that if you specify in your answer. – Mr. Xcoder – 2017-04-04T04:30:25.480
Why is this tagged [tag:code-golf]? – Roman Gräf – 2017-04-04T11:15:28.677
@RomanGräf because the shortest safe answer wins – Mr. Xcoder – 2017-04-04T11:16:32.953
Oh, I only read the winning condition of the robbers thread. – Roman Gräf – 2017-04-04T11:20:16.033
@Mr.Xcoder: can the input be 0? – user4867444 – 2017-04-06T15:36:40.673
Yes, it can. The corresponding output is
0
– Mr. Xcoder – 2017-04-06T15:37:32.117@Mr.Xcoder: The rules already say "you can assume n is always positive" which to me means that 0 does not need to be handled. Are you sure you want to change it? – tehtmi – 2017-04-06T17:39:30.563
0 is considered positive for this challenge @tehtmi – Mr. Xcoder – 2017-04-06T17:40:38.427
@Mr.Xcoder: is there a constraint on the performance? As in, is it acceptable for an answer to take a somewhat longer time to return? – user4867444 – 2017-04-07T18:21:02.937
@user4867444 On a standard computer, it should not take longer than 15 seconds to execute – Mr. Xcoder – 2017-04-07T18:21:53.117
@Mr.Xcoder OK thanks – user4867444 – 2017-04-07T18:23:41.210
@Mr.Xcoder so no accepted answer? – user4867444 – 2017-05-24T02:07:52.507