hdoj--5621--KK's Point(简单数学)
来源:互联网 发布:阿里云个人免费邮箱 编辑:程序博客网 时间:2024/06/12 01:46
KK's Point
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 350 Accepted Submission(s): 121
Total Submission(s): 350 Accepted Submission(s): 121
Problem Description
Our lovely KK has a difficult mathematical problem:He pointsN(2≤N≤105) points on a circle,there are all different.Now he's going to connect the N points with each other(There are no three lines in the circle to hand over a point.).KK wants to know how many points are there in the picture(Including the dots of boundary).
Input
The first line of the input file contains an integer T(1≤T≤10) , which indicates the number of test cases.
For each test case, there are one lines,includes a integerN(2≤N≤105) ,indicating the number of dots of the polygon.
For each test case, there are one lines,includes a integer
Output
For each test case, there are one lines,includes a integer,indicating the number of the dots.
Sample Input
234
Sample Output
35
Source
BestCoder Round #71 (div.2)
有交点需要有3个或者4个点,三个点的话,交点就是有公共点,相交的更像是一个角,四个点的话就是两天直线相交,因为题中说两两相交,那说明每一条线都会跟其他的线相交,并且不会有重复的交点,显然就是组合数C(4,4)+n,但是数据范围比较大,所以需要unsigned long long
#include<iostream>#include<cstdio>#include<cstdlib>#include<cmath>using namespace std;int main(){ int t;cin>>t; while(t--) { unsigned long long n; cin>>n; unsigned long long temp=n*(n-1)*(n-2)/6*(n-3)/4+n; cout<<temp<<endl; }return 0;}
0 0
- hdoj--5621--KK's Point(简单数学)
- hdoj 5621 KK's Point 【数学】
- hdoj KK's Point 5621 (数学&规律)
- HDU 5621 KK's Point(简单的数学题目)
- HDOJ 5621 KK's Point
- hdoj 5621 KK's Point <组合>
- HDOJ 5621-KK's Point【几何】
- HDU 5621 KK's Point (组合数学)
- HDU 5621 KK's Point(组合数学)
- HDU 5621 KK's Point(数学+规律题)
- HDU 5621 KK's Point(规律)
- hdu--5621KK's Point(排列组合)
- HDU 5621 KK's Point
- HDU 5621 KK's Point
- hdoj 5620 KK's Steel 【数学】
- hdu 5621 KK's Point【思维】
- hdu 5621 KK's Point【思维】
- 杭电5621 KK's Point
- find命令笔记
- 弹出窗体内容改变时刷新父窗体内容
- 统计学与机器学习相关概念
- nexus maven工厂配置
- 打印条码
- hdoj--5621--KK's Point(简单数学)
- 根据父窗体字段状态屏蔽操作按钮
- 2.1、决策树之信息增益与熵
- 点击按钮跳转到另一个页面
- 保存脚本判断字段非空(增行编辑)
- 1002. A+B for Polynomials (25)
- 平台实时弹框消息提醒SQL
- 2.2决策树之信息增益率
- 流程送审限制审核部门人员JS写法