ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

1716. Alternative Solution

Time limit: 1.0 second
Memory limit: 64 MB
Valentine is a veteran of programming contests and he's been working in the program committee for many years. He is very busy this week: the bike is under repair, some problems with Indian colleagues have to be solved, and five student groups are to be examined in philosophical problems of mathematics at the university. To crown it all, the new chairman of the program committee asked Valentine to write an alternative solution for one of the problems of the forthcoming contest.
Valentine was so busy that he had no time to read the problem statement. He only glanced at the output format and understood that it was required to output either “YES”, or “NO”.
Fortunately, Valentine was well acquainted with the testing system used in the contest. The system successively runs a solution on all tests of a problem, and for each test the checking process goes as follows. The input is copied to the file input.txt. Then the solution is launched. It reads the input from the file input.txt and writes the result to the file output.txt. When it finishes, the correct answer is copied to the file answer.txt. If the contents of the files answer.txt and output.txt match, the test is assumed to be passed; otherwise, the test is not passed.
Valentine decided to write a program that would operate as follows. If the folder containing the program doesn't contain the file answer.txt (i.e. the program is run on the first test), then the program outputs “YES”. Otherwise, the program outputs the contents of the file answer.txt.
Valentine plans to tell the chairman of the program committee that there is a nontrivial mistake in his program, and this mistake, fortunately, shows itself when the program is run on the excellent hard tests prepared by the author of the problem. However, first Valentine has to estimate the number of tests that his solution won't pass. Valentine doesn't have access to the tests, but he knows the number of tests and the total size of the files with answers. He also knows that the size of the file with the answer “YES” is 3 bytes, the size of the file with the answer “NO” is 2 bytes, and all the variants of the order of tests are equally probable. Help Valentine to calculate the average number of tests that his solution won't pass.


The only line contains two integers n and s (1 ≤ n ≤ 5000; 2ns ≤ 3n) which are the number of tests and the total size of the files with answers, respectively. The numbers are separated with a space.


Output the average number of tests that Valentine's solution won't pass, accurate to 10−5.


3 7


One of the three answers is “YES” and two answers are “NO”. If the order of tests is “YES-NO-NO”, then Valentine's solution won't pass the second test only; if the order is “NO-YES-NO”, then it will pass none of the tests; if the order is “NO-NO-YES”, the solution won't pass the first and the third tests.
Problem Author: Alexander Pronchenkov (prepared by Daniil Ayzenshteyn)
Problem Source: NEERC 2009, Eastern subregional contest