必威体育Betway必威体育官网
当前位置:首页 > IT技术

Counting regions —— 多边形对角线分割区域个数

时间:2019-06-10 01:42:07来源:IT技术作者:seo实验室小编阅读:91次「手机版」
 

多边形对角线

题目描述

Niuniu likes mathematics. He also likes drawing pictures. One day, he was trying to draw a regular polygon with n vertices. He connected every pair of the vertices by a straight line as well. He counted the number of regions inside the polygon after he completed his picture. He was wondering how to calculate the number of regions without the picture. Can you calculate the number of regions modulo 1000000007?It is guaranteed that n is odd.输入描述:The only line contains one odd number n(3 ≤ n ≤ 1000000000), which is the number of vertices.输出描述:print a single line with one number, which is the answer modulo 1000000007.

示例1

输入复制

3

输出复制

1

示例2

输入复制

5

输出复制

11备注:

The following picture shows the picture which is drawn by Niuniu when n=5. Note that no three diagonals share a point when n is odd.

有一个公式是对奇数的时候有作用的,我自己做的时候推,推不出来= =!

c++的时候也wa了,估计是哪里没处理到位,还好有Python

n=input();
n=eval(n);
n=n*n*n*n-6*n*n*n+23*n*n-42*n+24;
n=n//24;
n=n%1000000007;
print(n);

相关阅读

智能驾驶产业集群区域格局已成,起步北上广、落地看长沙

智能驾驶为国内各大城市带去的热度从去年开始持续发酵,各大城市也先后兴奋并且行动起来。目前,国内大大小小与智能驾驶相关联的测试

excel表格怎么设置排序区域

在excel表格中进行排序的时候,只需要对部分区域排序,应该如何设置呢?下面随seo实验室小编一起来看看excel设置排序区域的步骤吧,希望

矩形对角线之和

#include<stdio.h>int main(){int a[3][3];int i,j;int sum1=0,sum2=0;for(i=0;i<3;i++){for(j=0;j<3;j++){scanf("%d",&a[i][j])

天猫超市单品包邮区域有哪些?哪些地区肯定不包邮?

天猫超市1小时达服务已开进北京、上海、成都、武汉、杭州等五个城市,这意味者中国百姓的家庭一日三餐、日用消费都可以通过天猫超

使用DBScan + Kmeans计算区域集聚和中心点

DBSCAN,英文全写为Density-based spatial clustering of applications with noise ,是在 1996 年由Martin Ester, Hans-Peter Kri

分享到:

栏目导航

推荐阅读

热门阅读