POJ 3597 Polygon Division:题目解答源码

本文探讨了给定正多边形通过添加不相交对角线来将其划分为三角形和四边形的方法。提供了计算特定数量边的多边形所有可能划分的数量的算法,并说明了输入输出的要求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Given a regular polygon, there are numerous ways to divide it into several triangles and/or quadrangles by adding some diagonals that do not properly intersect each other. For example, Figure 4 shows all ten different divisions of a regular pentagon into triangles and quadrangles.

Figure 4: Divisions of a regular pentagon into triangles and quadrangles

Given n, the number of sides of the polygon, compute the number of such divisions.

输入描述

The input contains multiple test cases. Each test case consists of a single integern (3 ≤n ≤ 5000) on a separate line. The input ends where EOF is met.

输出描述

For each test case, print the answer modulo 264 on a separate line.

程序源码

完整代码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值