BestCoder Round #71 (div.2) (hdu 5621)
KK's Point
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 644 Accepted Submission(s): 220
For each test case, there are one lines,includes a integer N(2≤N≤105),indicating the number of dots of the polygon.
题意:一个圆上给n个点,将这些点两两相连,问有多少个交点
要求:1、圆上的点也算 2、圆内只有两条线的交点,没有两条以上线的交点
题解:圆上的点为n个,我们只需计算圆内有多少个交点即可,4个点可以在圆内形成一个交点,所以我们计算n个点可以组成多少个四边形即可
求解组合公式C(n,4)+n;
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<queue>
#define MAX 100100
#define INF 0x3f3f3f
using namespace std;
int main()
{
int t;
unsigned long long n;
scanf("%d",&t);
while(t--)
{
scanf("%llu",&n);
if(n<4)
{
printf("%llu\n",n);
continue;
}
unsigned long long ans=n*(n-1)/2*(n-2)/3*(n-3)/4+n;
printf("%llu\n",ans);
}
return 0;
}
BestCoder Round #71 (div.2) (hdu 5621)的更多相关文章
- BestCoder Round #71 (div.2) (hdu 5620 菲波那切数列变形)
KK's Steel Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total ...
- BestCoder Round #73 (div.2)(hdu 5630)
Rikka with Chess Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- Codeforces Round #316 (Div. 2) (ABC题)
A - Elections 题意: 每一场城市选举的结果,第一关键字是票数(降序),第二关键字是序号(升序),第一位获得胜利. 最后的选举结果,第一关键字是获胜城市数(降序),第二关键字是序号(升序) ...
- hdu 5424 Rikka with Graph II (BestCoder Round #53 (div.2))(哈密顿通路判断)
http://acm.hdu.edu.cn/showproblem.php?pid=5424 哈密顿通路:联通的图,访问每个顶点的路径且只访问一次 n个点n条边 n个顶点有n - 1条边,最后一条边的 ...
- BestCoder Round #69 (div.2)(hdu5611)
Baby Ming and phone number Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Ja ...
- BestCoder Round #71 (div.2)
数学 1001 KK's Steel 类似斐波那契求和 #include <cstdio> #include <cstring> #include <algorithm& ...
- Valentine's Day Round 1001.Ferries Wheel(hdu 5174)解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5174 题目意思:给出 n 个人坐的缆车值,假设有 k 个缆车,缆车值 A[i] 需要满足:A[i−1] ...
- Codeforces Round #240 (Div. 2)(A -- D)
点我看题目 A. Mashmokh and Lights time limit per test:1 secondmemory limit per test:256 megabytesinput:st ...
- BestCoder Round #36 (hdu5199)Gunner(水题)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud Gunner Time Limit: 8000/4000 MS (Java/Oth ...
随机推荐
- int string相互转换
一.itoa()和atoi() 注意:这两个函数并不是标准的C函数,而是windows环境下特有的函数. 1.itoa #include<iostream> #include<str ...
- eclipse导入javax.servlet.*的方法
1.下载web应用服务器tomact,网址http://tomcat.apache.org/download-80.cgi 这个根据自己系统进行选择. 2.将其加压到电脑中 3.在eclipse中添加 ...
- Qt之自定义界面(右下角冒泡)
简述 网页右下角上经常会出现一些提示性的信息,桌面软件中也比较常见,类似360新闻.QQ消息提示一样! 这种功能用动画实现起来很简单,这节我们暂时使用定时器来实现,后面章节会对动画框架进行详细讲解. ...
- java实现DES算法
import java.util.UUID; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypt ...
- UVa 10341 (二分求根) Solve It
很水的一道题,因为你发现这个函数是单调递减的,所以二分法求出函数的根即可. #include <cstdio> #include <cmath> //using namespa ...
- apache开源项目 -- tajo
一.体系架构 Tajo采用了Master-Worker架构(下图虚线框目前还在计划中),Master-Worker-Client之间的RPC通信是使用Protocol buffer + Netty来实 ...
- zollei的心动噪声探索性识别
<Exploratory Identification of Cardiac Noise in fMRI Images> 这个方法,最特别的地方在于, 是从静息态的大脑数据中,抽取心动结构 ...
- 【C#学习笔记】类型转换
using System; namespace ConsoleApplication { class Program { static void Main(string[] args) { " ...
- Oracle 创建和使用视图
一.what(什么是视图?) 1.视图是一种数据库对象,是从一个或者多个数据表或视图中导出的虚表,视图所对应的数据并不真正地存储在视图中,而是存储在所引用的数据表中,视图的结构和数据是对数据表进行查询 ...
- mysql索引与优化
mysql 索引与优化 http://www.cnblogs.com/hustcat/archive/2009/10/28/1591648.html