KK's Point

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 938    Accepted Submission(s): 307

Problem Description
Our lovely KK has a difficult mathematical problem:He points N(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 integer N(2≤N≤105),indicating the number of dots of the polygon.

Output
For each test case, there are one lines,includes a integer,indicating the number of the dots.
Sample Input
2 3 4
Sample Output
3 5
Source
BestCoder Round #71 (div.2)
Recommend
hujie   |   We have carefully selected several similar problems for you:  5634 5633 5632 5631 5630 
每四个会出现一个交点,本题数据较大long long 过不去,需要加unsigned:
#include<stdio.h>
unsigned long long int i,j,k,l,m,n,p,ans;
int main()
{scanf("%I64u",&p);while(p--){scanf("%I64u",&n);k=n; if(n>=4)k=k+n*(n-1)/2*(n-2)/3*(n-3)/4;printf("%I64u\n",k);}
}

杭电5621 KK's Point相关推荐

  1. 杭电5620 KK's Steel

    KK's Steel Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total ...

  2. 2022“杭电杯”中国大学生算法设计超级联赛(4)

    2022"杭电杯"中国大学生算法设计超级联赛(4) [题目链接](Search Result (hdu.edu.cn)) D Link with Equilateral Trian ...

  3. 【杭电ACM】1097 A hard puzzle

    [杭电ACM]1097  A hard puzzle http://acm.hdu.edu.cn/showproblem.php?pid=1097 先用int手写了算法结果竟然wrong answer ...

  4. 【ACM】杭电OJ 1106 函数atoi

    函数atoi是把字符串转化成整数的函数,头文件为 #include "stdlib.h" e.g. 运行环境:Dev-C++ 5.11 杭电1106 调用了sort函数,运行的时间 ...

  5. 【ACM】杭电OJ 2037

    题目链接:杭电OJ 2037 先把b[i]进行排序,然后,b[i]与a[i+1]进行比较. #include <iostream> #include <cstdio> #inc ...

  6. 【ACM】杭电OJ 2020(排序)

    题目链接:杭电OJ 2020 排序可以有冒泡排序,选择排序,或者直接调用函数. 下面是选择排序: #include <stdio.h> #include <math.h> in ...

  7. 【ACM】杭电OJ 2018

    题目链接:杭电OJ 2018 从n>4开始,每一年的牛的数量=前一年的牛的数量+三年前的牛的数量 问:为什么是三年前? 答:假设三年前有一头小牛出生,出生的那一年即为第一年,到了第四年,即三年后 ...

  8. 【ACM】杭电OJ 1005

     题目链接:杭电OJ 1005 超时代码如下(而且开辟的数组空间大小不够): #include <stdio.h> int m[100000]; int f(int n,int a,int ...

  9. 【ACM】杭电OJ 1004

     题目链接:杭电OJ 1004 运行环境:Dev-C++ 5.11 思路: 先把先把num数组全部赋值为1:第一个颜色单独输入,从第二个开始,需要与前面的进行比较,如果前面有相同的颜色,则在目前的nu ...

最新文章

  1. 台式电脑怎么改计算机名,台式电脑的设置在哪里
  2. Spring JdbcTemplate batchUpdate() 实例
  3. fastadmin在html中查询数据,FastAdmin模块开发快速上手
  4. [转]汇编语言的准备知识--给初次接触汇编者 3
  5. vuejs对象更新渲染_vue 数组和对象渲染问题
  6. Java 一维数组 二维数组 三维数组
  7. 是时候该开始读一读JDK源码了
  8. iOS 端 HTTP 抓包分析工具推荐-Thor
  9. vue插件集合17:vue获取国家以及地区的方法
  10. LDA Effect Size分析 LEfSe详解
  11. 使用SQL语句在K3里进行反结帐- -
  12. Gearman中文手册技术文档分享chm
  13. java计算机毕业设计Web产品管理系统MyBatis+系统+LW文档+源码+调试部署
  14. 【实时语音转文本】PC端实时语音转文本(麦克风外音系统内部音源)
  15. 用好这 28 个工具,开发效率爆涨|云效工程师指北
  16. eclipse上插入中文到mysql,但是navicat显示问号《网上很多方法都没用》,最终google到了精品
  17. 三万字,100题!Linux知识汇总!
  18. Linux——Makefile文件
  19. 代谢组+基因组联合分析
  20. [数据库] mysql必知必会(一):常用命令

热门文章

  1. python __call__或者说func()()的理解
  2. PS打造油画般的风景人像
  3. Linux时间与NTP
  4. 图解Picasso源码
  5. purrr 0.2.0
  6. 关于JFace中的右键菜单Action类,ActgionGroup类,MenuManager类
  7. Problem C: 默认参数:求圆面积
  8. iOS - OC RunLoop 运行循环/消息循环
  9. Js 通过点击改变css样式
  10. DNS服务启动时卡在:Generating /etc/rndc.key: