⬆️ ⬇️

Competition for programmers



The other day marks the year of our blog on Habré. And we decided to celebrate this case! No, well, not the way you thought. Although so, of course, too. But now is not about that.



We really want to give all our readers some gifts, but we have only one gift (but a good one), so we decided to play it in a small contest for programmers. Competition conditions and prize description - under the cut. Tasks do not take much time, everyone has a chance to win.



Prize



We wanted to make the prize not only valuable, but also unique and memorable. In the end, you can buy a new piece of hardware to a computer or a phone without us, but to receive as a gift entertainment for several kilobaksov is a memorable event. So we give us a VIP-ticket of the UEFA Corporate Hospitality Program for the match Sweden-France, which will be held on June 19 in Kiev in the framework of the Euro 2012 Championship.



The ticket includes includes:



The match Sweden-France starts at 21.45, while the UEFA entertainment program starts at 18.45 and will continue after the match ends.

')

The task



So, regarding the above event, we decided to write several programs that would output the text “1 year on #habr!”. Well, almost “Hello world!” That is. We wrote them, but unfortunately, something in them does not work. Or it does not work that way. In general, they do not deduce what is required. It seems to us that each of the programs can be fixed by fixing in literally one line. Perhaps you can do this? Oh yes, in what languages ​​we wrote - also already forgotten. We'll have to guess along the way. For each solved problem - 1 point.



Exercise 1
var howManyYears = 1; howManyYears += "1"; howManyYears -= "1"; alert(howManyYears + " year on #habr!"); 




Task 2
 howManyYears = 1 if (howManyYears =! 0) puts "#{howManyYears} year on #habr!" end 




Task 3
 #include <iostream> #include <vector> int main() { std::vector<int> monthes; // we are here from 06/2011 - 12 monthes monthes.push_back(06); monthes.push_back(07); monthes.push_back(08); monthes.push_back(09); monthes.push_back(10); monthes.push_back(11); monthes.push_back(12); monthes.push_back(01); monthes.push_back(02); monthes.push_back(03); monthes.push_back(04); monthes.push_back(05); std::cout << monthes.size() / 12 << " year on #habr!"; return 0; } 




Task 4
 [regex]::replace('1 year on $habr!','$','#') 




Task 5
 #include <stdio.h> int main() { int years = 0; printf("%d year%s on #habr!", ++years, years == 1 ? "" : "s"); http://www.infopulse.com.ua/eng/Career/Vacancies/Software-Development/ return 0; } 




Task 6
 SET X, 0 :start SET A, [string+X] IFE A, 0 SET PC, end BOR A, 0x7000 SET [0x8000+X], A ADD A, 1 SET PC, start :string dat "1 year on #habr!",0 :end SET PC, end 






Bonus task


You may have noticed a reference in task number 5 (by the way, why does its presence not break the compilation of code in this language?). So, one extra bonus point can be obtained by those people who, among the vacancies on this very link, will find something interesting for themselves and send their resume at the contest period to the address deleted (do not forget to specify the twitter account from which the main decision was published). If you like the tasks in this competition, you will also like the vacancies (there such tasks are met daily, even much more interesting). And we like people who solve similar problems. Such a test for mutual sympathy. And one bonus point in the competition.



Contest Rules



Answers need to be published somewhere on the Internet (pastebin or Google Docs will completely disappear), and throw a link to them on Twitter. A tweet with a link should also contain the text " #habr @Infopulse_ukr ". The answer to each task should be in the following format:



 №    №    (   -  )     




Example:

 1 C++ 12 printf("1");  "1"    ,     printf  . 




Answers to tasks should be separated by an empty string. Only replies sent in the above manner in the format described above are accepted. Answers in the spirit of “write in the first line print and exit” or “immediately goto the line with print” do not work, the error in the original code should be corrected, preserving the logic of its algorithm. The deadline for receiving responses is 2 days from the date of post publication. Having an account on Habré to participate is optional. The prize will be given to the person who has scored the maximum number of points (if there are several, the first one). The winner will be announced on Sunday, June 17th. The prize will be awarded on Monday, June 18th.



Good luck to all. Go.

Source: https://habr.com/ru/post/145783/



All Articles