Are you in love with algorithms? If you are don't miss this round and be algorithm's valentine ;)
On the night before valentine's day (exact time), Valentine Algorithm cUp 2015 is going to take place.
There will be 6 problems and 3 hours to solve them. All of them are written by me(PrinceOfPersia).
This competition is like surprise languages but too different. 3 days before the contest, I will publish tutorial of 5 new algorithm languages(not programming languages) with their compiler codes. Each language is going to be really simple to learn and have at most 6 or 7 commands (they're not like programming languages).
Your program should print the code written in the language the problem says and checker will run it (pay attention that inputs are encoded, don't try to read form input, just print the code). Don't use unnecessary wjitespaces.
Each command of a language, will have a number, shown by w(x) called order. There will be a counter cnt = 0 (initially), every time your code calls this command, cnt increases by x. The order of your code equals the final value of cnt.
Each problem has a limit for your code's order.
If your code gets CE or OLE (order limited exceeded) or WA, you will receive Wrong answer.
Example :
Language (named EXM) : This language is built to process on an integer. There are two valid commands :
- M x : multiply the number by x. (Order : w(x) ).
- I x : increase the number by x. (Order : w(1) ).
Your program returns the final value of that number.
Your task is given number n, the return value of your code must be number 2n + 1 .
Code in EXM:
M 2
I 1
C++ code (the code you will submit in submit page):
printf("M 2\nI 1\n");
Your code's order will be 2 + 1 = 3 .
UPD: You can download languages tutorial and their compilers here.
Attention: Compile the code for each language, in Windows : g++ -o lang lang.cpp -O2 -std=c++0x
and in Mac and Linux g++ -o lang.out lang.cpp -O2 -std=c++0x
.
Using in Windows:
For running your code that is saved in a file like x.txt
, use exactly lang x.txt
in cmd and if you want debug mode enabled, use lang x.txt -d
(not lang -d x.txt
).
Using in Mac OS X or Linux:
For running your code that is saved in a file like x.txt
, use exactly ./lang.out x.txt
in terminal and if you want debug mode enabled, use ./lang.out x.txt -d
(not ./lang.out -d x.txt
).
Sample problem:
Write a program in Prolan that given a string s containing only a and b deletes all bs and converts all as to d. Order shouldn't exceed 106 (1 ≤ |s| ≤ 100).
My code:
(b,)
(a,d)
If you have any question, feel free to ask.
UPD2: Scoring will be 500-1000-1500-2000-2500-3000.
By the way, the main characters of each problem is different from other problems. Actually, for each problem the main characters are an imaginary(or not!) couple :)
UPD3: IDXT's compiler had some bug, you can download the correct source here.
UPD4: For people who want to practice, the new archive(including languages tutorials and bugless compilers) can be found here.