joj2026

2026: Divide the Birthday Cake


ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE
1s10240K482223Standard

On L.X.'s birthday, I bought her a big Birthday Cake, and she felt very happy.
"So how do you divide the cake?" I asked.
"I do not know. I do not want to simply divide it into several sectors. Hmn, Let me see. The cake is a little strange. Its shape looks like a polygon. En, I want to divide it into small pieces of triangles. I mean, if there are N sides, there should be N-2 small triangles. We can use N-3 diagonal(s) which do not intersect inside of the polygon to divide the cake into N-2 triangles." She said.
"Yeah, of course we can. It is an easy job." I took out a pencil and drew a dividing method on the paper.
"Yes. But I want to know how many different methods to divide the cake?" She smiled.
"Ah, it is not difficult. I will tell you the answer later!" said.
"Ok, but if you do not get the answer at last, you cannot eat the cake!"
"Ok…"

Then I began to calculate the number and she began to cut the cake. But I didn't get the answer, for there were 16 vertexes. Oh, I was hungry! You must help me!!!

Here are the examples of "VALID" and "INVALID" dividing method.

1003

Input

There are several lines in the input file, each line contains a number N stands for the number the vertex of the polygon. 5<=N<=31. Your program should proceed to the end of the file.

Output

Print the number of dividing method one per line.

Sample Input

5
6

Sample Output

5
14

Problem Source: billjeff


This problem is used for contest: 7 


Submit / Problem List / Status / Discuss


评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值