All submissions for this problem are available.
On Saturday night you want to go to a dance club which allows you to enter at no charge only if you
enter a pin code which matches with the one in the system.
That system is programmed to accept pins which belong to Fibonacci series or contain the digits of
consecutive numbers as they appear in Fibonacci series. The order of digits is important as the pin
should be the concatenation of digits from next Fibonacci number to digits from consecutive
previous number in Fibonacci series. Also, the total no. of digits i.e. length of pin must range from 4
Design a system to check if PIN entered is correct. If it is correct, print
Accepted or for any other cases print Denied.
Single line containing pin N
Single line with either Accepted or Denied.
Sample test cases:
- 4 ≤ (no. of digits in N ) ≤ 6
- Fibonacci series should be checked till Max 6 digit Fibonacci number
1322 is denied because there are no consecutive Fibonacci numbers that can make 1322.
1321 is accepted because 13 and 21 are consecutive Fibonacci number and we get the pin by
concatenating 13 and 21.
15972 is accepted because 1597 and 2584 are consecutive Fibonacci number and by concatenating 2
from 2584 to 1597 we get the pin 15972.
9725 is accepted because 1597 and 2584 are consecutive Fibonacci number and by concatenating 25
from 2584 to 97 from 1597 we get pin 9725.
81321 is accepted because 8, 13 and 21 are consecutive Fibonacci number and their concatenation
gives the pin.
813 is denied because it has 3 digits and range of pin is from 4 to 6 although 8 and 13 are
consecutive Fibonacci number.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.