Shortest Code Contest

Write a piece of code to solve some mathematical expressions.
These mathematical expressions will be very simple - each expression will consist of two numbers and a single operation.
All numbers will be positive integers less than 100, and the only operations will be +,- and *.
There will be multiple test cases - the first line will indicate the number of tests.

Oh, I almost forgot to mention: you can't use semicolons!
Your score will be (86 / N)2 x 10, where N is the number of non-whitespace characters in your code.

Sample Input


Sample Output


All Submissions
Best Solutions

Point Value: 10 (partial)
Time Limit: 2.00s
Memory Limit: 16M
Added: Dec 14, 2008

Languages Allowed:
C++03, C, C++11

Comments (Search)


can someone please help me? thanks

why my code is unpredictable? test perfect on my computer

read this

or is there a way to do it in java?

Correct, you may not solve this problem in java.

Why can't Python solutions be submitted? If the solution doesn't include a semicolon, I don't see why it shouldn't be accepted (even if it is a really simple solution).

In certain interpreted languages such as Python and Ruby, semicolons are optional and thus the problem is trivial.
The whole reason semicolons are disallowed is to make the problem somewhat challenging.

Fair enough.

Is system() in C disabled on the judge?

Yes --- processes are not allowed to fork().

nope. no semicolons allowed.

Please read all the comments before posting. Perhaps your question is already answered.

You can declare variables with int main():
e.g. int main(int a, int b) ...

what about
using namespace std;? oO

What about it? You can't use it because that would require a semicolon!

If you '#include <rope.h>', you won't need the using namespace std; (and it has cout/cin)
This won't work in Visual C++, though.

Edit: #include <list.h> is better

Ah! Too many hints! You can't just give it away like that -_-

I'm just wondering (although probably a lot more work for nothing), since C obviously has an advantage, can there be separate marking schemes for C and C++?

C doesn't have that big an advantage over C++, so no, only one marking scheme.

It's not like we even know C (or at least I don't), so you can just try figure it out.

The only difference between C and C++ that is significant for this problem is that you don't need any #include statements to input/output in C, but you are restricted to the following I/O routines (no cin/cout):

What happened to your 10/10?

OK. Apparently 86 chars is possible, I'll leave it at that.
However I made the scoring curve a bit more lenient. Edit: Can't make it too easy tongue.gif

i really need 10 pts... WHy was there the no semicolon rule anyway?

PS. there are 79 answers accepted?!?

Without that rule, there's no challenge whatsoever and it would be a very very easy 10 points.

unfortunatly, i have no knowledge in c++ or c.

Hence, you don't get 10 points.