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
3 6*7 67-25 31+11
Sample Output
42 42 42
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)
The whole reason semicolons are disallowed is to make the problem somewhat challenging.
e.g. int main(int a, int b) ...
using namespace std;? oO
This won't work in Visual C++, though.
Edit: #include <list.h> is better
It's not like we even know C (or at least I don't), so you can just try figure it out.
here
However I made the scoring curve a bit more lenient. Edit: Can't make it too easy
PS. there are 79 answers accepted?!?