Zju2271 Chance to Encounter a Girl
时间限制:1s 空间限制:64MB
题目描述
Long long ago, there was a small but beautiful country, in which lived a very smart girl. The girl was very interested in travelling, every day she travelled from one town to another. Her sense of direction is so bad that she always forgot the road which she had came from and randomly chose a town in the country to move on. She never went out of the country. You, a very cool man, go back to the past using a time machine and travelled through the country. If you could meet the girl, love would happen and the story would have a happy end. So, what's the probability of a happy end? The country consists of n * n blocks (n = 2*k - 1; k = 2,...,50), each block is a town. Every day, the girl can move up, left, down or right to a neighbor town, and you, the cool man, must move right until you meet the girl or get outside the country. Assume the left bottom town is (0, 0). Initially, the girl is in the town (n/2, n/2) and you are in (-1, n/2). The following figure is a sample of country (3 * 3), G is the girl's inital position and Y is yours. +-+-+-+ | | | | +-+-+-+-+ |Y| |G| | +-+-+-+-+ | | | | +-+-+-+
输入格式
There are multiple test cases(less than 30). For each case there is only one line containing an integer n (n = 2 * k - 1; 1 < k <= 50).="" proceed="" until="" the="" end="" of="" file.="" <="" p="">
输出格式
For each test case you should print the possibility of a happy end. Round to four decimal digits.
样例输入
3
样例输出
0.6667
提示
本题有多组数据,请做到文件底结束.
题目来源
没有写明来源
=>