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
Mitch Schwartz:
2015-04-03 15:06:26
@Archit Kapoor: Leading zeroes are only to make "a" have exactly 3 digits. |
|
Archit Kapoor:
2015-04-03 10:06:10
Isn't there any limit on the number of leading zeros? |
|
Mitch Schwartz:
2013-05-31 10:35:22
Are you referring to the size of a cell? That's implementation dependent, and in this case they are 32-bit. |
|
Kyle:
2013-05-30 03:34:54
Is 0<=a<256? I know my program doesn't work with numbers larger than 1 byte, but I got AC anyway. |
|
Mitch Schwartz:
2013-01-15 15:47:34
Ok, @Mostafa I sent a PM with detailed explanation about needing hundreds of test cases for strong data. Please reconsider changing the format to allow multiple test cases in an input file :). |
|
Mostafa 36a2:
2013-01-15 15:47:34
@Tjandra Satria Gunawan : you're right !
|
|
Aditya Pande:
2013-01-15 15:47:34
@mostafa: i would like to see how you implemented the judge... i might also write some interesting new judges so please mail it to me if you can...
|
|
(Tjandra Satria Gunawan)(曾毅昆):
2013-01-15 15:47:34
Yes the problem is solved for guessing input data, but for scoring, i think it's still not perfect, because the code can expand differently depend on the input.. so the score that appear on rank page is not score for general case, but it's score for specific case only... |
|
Mostafa 36a2:
2013-01-15 15:47:34
i think the problem was using the handle spoj_p_info so i try the handle spoj_u_info and it works ...
|
|
Mitch Schwartz:
2013-01-15 15:47:34
"The Best Code Is The General Code which solve any case" -- I agree that's the best code, but I'm afraid getting the best *score* will entail guessing the input, once it is finalised, unless there are hundreds of test cases and not less. It is the nature of this problem and its scoring, and taking a general solution like mine and tweaking it for specific input. I think the judge can be written to be virtually as fast as bff (by copying the code and making slight adjustment to keep track of the count), so as far as squandering server time I don't think that's a problem, and I don't see a real need to actually generate the expanded code and print it if that's the main concern. I'll send a PM later today when I can. Last edit: 2013-01-10 15:08:57 |
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 |