BFMODULO - "a mod b" in BF
your task is simple ..find the answer of a mod b as fast as you can.
a and b are integers
0<=a<1000 and 0<b<10
Input:
integer a with leading zeroes
then space ASCII(32)
then b .. and EndOfLine ASCII(10)
output:
the value of(a mod b)
Example1:
input:
999 2
output:
1
Example2:
input:
005 6
output:
5
Example3:
input:
099 1
output:
0
Score:
Sometimes I enjoy writing lots of '+' in my code ..
but sometimes I prefer some thing like ++++[->++++<] to shorten it.
But With This New Judge, the first way is shorter.
This New BF_OPERTIONS_COUNTER counts how many BFoperations your implemintaion do ..
example..
code1 : +++++++++++++++.
code2 : +++[->+++++<]>.
as you see LengthOfcode2< LengthOfcode1
But .. the judge look at code2 like this:
+++[->+++++<]->+++++<]->+++++<]>.
and It will count these operators : '+','-','<','>' only
so : code1 will have score of 15
and code2 will have score of 28
Score is "how many '+','-','>','<' your code does at the run time"
BUT: since there is many test files ... and your code may expand or shorten as the judge see it ..
So the final Score will be your scores average ...
Thanks for Tjandra Satria Gunawan for his suggestion for the new judge .
note: you can see how the judge read your code at your submission info (only the first test file).
LAST UPDATE NOTE 15/1/2012:
I've complete improving test files ... there is now 59 test files ,also now you can write 100,000 byte code
after solving the problem,maybe you can see that MCLT: MORE CODE --> LESS TIME
Enjoy :)
hide comments
Mostafa 36a2:
2013-01-15 15:47:34
@Mitch Schwartz and @Tjandra Satria Gunawan : The Best Code Is The General Code which solve any case .. cause i will add another 7 inputs files ..
|
|
Aditya Pande:
2013-01-15 15:47:34
maybe i should start optimizing...
|
|
Mitch Schwartz:
2013-01-15 15:47:34
How about having multiple test cases per input file? (With or without "T" number of test cases on first line.) Of course it would invalidate current entries, but modifying code to handle multiple cases is not a big deal I think, and all entries so far have gotten 0.00s, so this could be the best solution. And, data should not just be random but also have some special qualities to prevent specific exploits. Last edit: 2013-01-10 08:17:29 |
|
(Tjandra Satria Gunawan)(曾毅昆):
2013-01-15 15:47:34
@Mostafa 36a2: I agree with Mitch Schwartz, this problem must have many cases to get the general score (good scoring for general case), my last submission is faster (less commands) only for large A, but seems that it slower (more commands), so I think to get the good scoring, you should increase number of random test data.. Last edit: 2013-01-10 07:51:04 |
|
Mitch Schwartz:
2013-01-15 15:47:34
@Mostafa: After more thought, exploiting weak input data is pretty embedded into this problem, hundreds of test cases are required to make the test data really strong. I don't know what to recommend. If you need an explanation, let me know. Last edit: 2013-01-10 07:29:55 |
|
Mitch Schwartz:
2013-01-15 15:47:34
My code is also not fully optimised, I avoided certain ideas for now to keep the code relatively "clean", a term I use very loosely... Anyway, I prefer this not to be a "guess the input weakness" game; please make the test data stronger. A lower bound for this is 17 input sets, probably more but I haven't thought about it that deeply.
|
|
(Tjandra Satria Gunawan)(曾毅昆):
2013-01-15 15:47:34
Finally only ~500 commands :-)
|
|
Mitch Schwartz:
2013-01-15 15:47:34
Thanks for the info! And please make sure every possible value of b appears in the input data, I think otherwise it would be too weak.
|
|
Mostafa 36a2:
2013-01-15 15:47:34
@ Aditya Pande : you should press the word BF at right of your submission
|
|
Mostafa 36a2:
2013-01-15 15:47:34
@Mitch Schwartz : my compiler do the same as the BF compiler in spoj do..
|
Added by: | Mostafa 36a2 |
Date: | 2013-01-07 |
Time limit: | 1s |
Source limit: | 100000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | BF |
Resource: | FizzBuzz Happy 2013 |