HUST_ACdream区域赛指导赛之手速赛系列(1)(2)D——数学——Triangles

Description

已知一个圆的圆周被  个点分成了 N 段等长圆弧,求任意取三个点,组成锐角三角形的个数。

Input

多组数据。

每组数据一个N (N ≤  1000000)。

Output

对于每组数据,输出不同锐角三角形的个数。

Sample Input

3
4
5

Sample Output

1
0
5大意:数学推导,分成奇数点偶数点讨论偶数时:只要两个相减就是答案奇数时同理:还有1ll*涨姿势用来变成long long 形式

#include<cstdio>
#include<cstring>
int main()
{
    long long n;
    while(~scanf("%lld",&n)){
        if(n % 2 == 1){
            long long temp1 = 1ll*n*(n-1)*(n-2)/6;
            long long temp2 = 1ll*n*(n-1)*(n-3)/8;
            printf("%lld\n",1ll*(temp1 - temp2));
        }
        else {
            long long temp1 = 1ll*n*(n-1)*(n-2)/6;
            long long temp2 = 1ll*n*n*(n-2)/8;
            printf("%lld\n",1ll*(temp1 - temp2));
        }
    }
   return 0;
} 


 

 
时间: 2024-10-10 03:58:41

HUST_ACdream区域赛指导赛之手速赛系列(1)(2)D——数学——Triangles的相关文章

HUST_ACdream区域赛指导赛之手速赛系列(1)(2)G——BFS——Cutting Figure

Description You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares that we can delete from set A to make i

HUST_ACdream区域赛指导赛之手速赛系列(1)(2)F——GCD+1ll——LCM Challenge

Description Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it. But I also don't want to use many numbers, so I'll choose three positive integers (they do

ACdream区域赛指导赛之手速赛系列(5) 题解

A - Problem A Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) SubmitStatus Problem Description The decimal numeral system is composed of ten digits, which we represent as "0123456789" (the digits in a system are

ACdream区域赛指导赛之手速赛系列(7)

A - Dragon Maze Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) SubmitStatus 题目连接:     传送门 Problem Description You are the prince of Dragon Kingdom and your kingdom is in danger of running out of power. You must find

ACdream区域赛指导赛之手速赛系列(6)

Problem Description Sudoku is a popular single player game. The objective is to fill a 9x9 matrix with digits so that each column, each row, and all 9 non-overlapping 3x3 sub-matrices contain all of the digits from 1 through 9. Each 9x9 matrix is par

快速切题 acdream手速赛(6)A-C

Sudoku Checker Time Limit: 2000/1000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitStatisticNext Problem Problem Description Sudoku is a popular single player game. The objective is to fill a 9x9 matrix with digits so that each colu

Acdream手速赛7

蛋疼啊,本次只做出了一道题目...渣爆了... 妈蛋,,卡题之夜..比赛结果是1道题,比赛完哗啦哗啦出4道题.. A acdream1191 Dragon Maze 题意: 给一个迷宫,给出入口坐标和出口坐标,要求从入口到出口的步数尽可能少,如果有多种方案,则要求获得的分数尽可能多,获得的分数为经过的方格的数字之和 思路: bfs求最小步数,每走一步更新一下走到这个格子的最大权值 #include <bits/stdc++.h> using namespace std; typedef lon

Java制作最难练手速游戏,Faker都坚持不了一分钟

想练手速,来啊,互相伤害啊 Java制作最难练手速游戏,目测Faker也坚持不了一分钟 制作思路:只靠Java实现.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java.Java. 字母模型应该是整个游戏的主角,因为整个游戏过程中都涉及到它的运动,比如坠落,消失,产生等,首先应该考虑字母随即出现的位置,在游戏中不断下落,计算下落的高

猫和老鼠 蓝桥杯/手速/暴力练习赛(暴力搜索)

猫和老鼠 蓝桥杯/手速/暴力练习赛 [题目描述] 猫和老鼠在10*10 的方格中运动,例如: *...*..... ......*... ...*...*.. .......... ...*.C.... *.....*... ...*...... ..M......* ...*.*.... .*.*...... C=猫(CAT) M=老鼠(MOUSE) *=障碍物 .=空地 猫和老鼠每秒中走一格,如果在某一秒末他们在同一格中,我们称他们“相遇”. 注意,“对穿”是不算相遇的.猫和老鼠的移动方式相