<PREV Problem:
NEXT>
Solved by 55 users: ...
UserDateAttemptTimeCMSC
Rizvanov05 aug 2009C++900.10947 
Robert_Gerbicz20 jul 2009C++1000.131903 
Dest09 dec 2009C++200.185321 
Vladimir_Sitnikov23 apr 2009C700.301397 
Vladimir_Sitnikov20 apr 2009Ruby400.34154 
kornakovBSU23 sep 2010C++1000.45958 
regal27 apr 2009C++1400.502189 
Vladimir_Sitnikov18 apr 2009Ruby300.56127 
Fat20 apr 2009Haskell700.64268 
Alexeyev81407 may 2009Ruby100.64866 
DmitrievVladimir81406 may 2009Ruby500.64866 
gafrustam81414 may 2009Ruby100.65866 
Alexeyev81407 may 2009Ruby200.66866 
Languages
Java
20
Ruby
20
C++
14
Haskell
2
Python
2
C
2
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

Knight's move II

Time limit = 1 second

Chess association decided to assign new phone numbers to all the members. The new numbers should be produced with a knight's move on a phone keypad. 0 and 8 are not valid leading digits. For instance, the number 340-49-27 matches the criteria.

789
456
123
 0 

Create a program that computes the number of different phone numbers with a length N.

Input Integer N ( 1 ≤ N ≤ 56'789 )

Output Number of valid phone numbers

Input#1
2
Output#1
16

Author:
Peculiarities of national computer science problems
2000

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 190ms

SW soft NIX
ID = 18.232.51.247