10611 - 邮政货车

郊区呈矩形,有四条东西方向的街道和N(1<=N<=1000)条南北方向的街道。在交区的西北角有一个邮局。

如N=5时,郊区如下图所示,圆点表示邮局,直线表示街道。
每天邮政卡车从邮局出发,每个十字路口(包括边界和四角)经过且只经过一次。现在邮局希望知道邮政货车行驶的路线有几种。

输入

一行:一个数值N

输出

一行: 到INPUT中给出的街道的路径总数

样例

输入

4

输出

12

提示

Postal Vans ACM South Pacific Region -- 2003

Tiring of their idyllic fields, the cows have moved to a new suburb. The suburb is a rectangular grid of streets with a post office at its Northwest corner. It has four avenues running East-West and N (1 <= N <= 1000) streets running North-South.

For example, the following diagram shows such a suburb with N=5 streets, with the avenues depicted as horizontal lines, and the post office as a dark blob at the top-left corner:

Each day the postal van leaves the post office, drives around the suburb and returns to the post office, passing exactly once through every intersection (including those on borders or corners). The executives from the post company want to know how many distinct routes can be established for the postal van (of course, the route direction is significant in this count).

For example, the following diagrams show two such routes for the above suburb:

As another example, the following diagrams show all the four possible routes for a suburb with N=3 streets:

Write a program that will determine the number of such distinct routes given the number of streets.

PROGRAM NAME: vans INPUT FORMAT Line 1: A single integer, N SAMPLE INPUT (file vans.in) 4

OUTPUT FORMAT Line 1: A single integer that tells how many possible distinct routes corresponding to the number of streets given in the input. SAMPLE OUTPUT (file vans.out) 12

时间限制 1 秒
内存限制 128 MB
讨论 统计
上一题 下一题