N-K Special

View as PDF

Submit solution

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 16M

Problem type
Allowed languages
Assembly, Brain****, C, C++, COBOL, Forth, Fortran, Java, Lua, Prolog, Text, Turing

We define "n-k special" set X of positive integer numbers as follows:

  • each element x that belongs to set X must meet the restriction 1 \le x \le n.
  • the sum of elements of the set X must be larger than k.
  • no pair of elements belonging to the set can be consecutive numbers.

Write a program that reads n and k (1 \le n \le 100; 0 \le k \le 400) as its input and outputs the total number of "n-k special" sets.

Sample Input

5 6

Sample Output

3

Explanation

Sets:

  1. \{1, 3, 5\}
  2. \{2, 5\}
  3. \{3, 5\}

meet the given criteria. No other sets exist.


Comments

There are no comments at the moment.