#Lutece0419. Android key
Android key
Migrated from Lutece 419 Android key
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Xixi has a smart phone with Symbian OS. She loves it for its convenience and massive software supplies. But recently, she could not help but notice that more and more people are using Android. Not only the staff at Google, but also her boyfriend and many other ACM team members are turning to Android users.
If you are already a user of Android, you must be familiar with its key lock system. The Android lock system uses a series of nine dots in a square that you need to replicate a pre-set pattern to unlock the phone.
Starting from one dot in the square, you can then move to the adjacent dot in four directions, up, down, left, and right. Sometimes you are on the edge or corner, your choices will be limited to or directions.
Another rule of setting the lock is that you cannot move to the dot that you have already visited. So is a valid lock, whereas is not.
Now xixi has found poemqiong’s new cell, and it is an Android phone. Knowing the length of peomqiong’s phone lock is , she wonders how many different lock patterns are there.
To make this problem a little more difficult, we assume that the keyboard is square, instead of . An square has columns and rows.
Now, given ), () and the length of the lock pattern (), can you write a program to help xixi figure out how many patterns are there?
Input
, ,
Output
The number of different patterns, noting that and are two different patterns.
Samples
2 2 3
3 3 2
8
24
Resources
5th BUPT Programming Contest Preliminary