FZOJ Problem 2110 Star
Accept: 996 Submit: 2958
Time Limit: 1000 mSec Memory Limit : 32768
KB
Problem Description
play and chat on the playground. One day, there are a lot of stars in the sky.
Suddenly, one of Overpower’s classmates ask him: “How many acute triangles whose
inner angles are less than 90 degrees (regarding stars as points) can be found?
Assuming all the stars are in the same plane”. Please help him to solve this
problem.
The first line of the input contains an integer T (T≤10), indicating the
number of test cases.
For each test case:
The first line contains one integer n (1≤n≤100), the number of stars.
The next n lines each contains two integers x and y (0≤|x|, |y|≤1,000,000)
indicate the points, all the points are distinct.
Output
number of different acute triangles.
Sample Input
3
0 0
10 0
5 1000
Sample Output
#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;
const int N_MAX = + ;
int n;
ll x[N_MAX], y[N_MAX]; bool judge(int i,int j,int k) {
return (x[i] - x[j])*(x[i] - x[k]) + (y[i] - y[j])*(y[i] - y[k])>;
} int main() {
int T;
scanf("%d",&T);
while (T--) {
scanf("%d",&n); for (int i = ; i < n;i++) {
scanf("%lld%lld",&x[i],&y[i]);
}
int num = ;
for (int i = ; i < n;i++) {
for (int j = +i; j < n;j++) {
for (int k = j + ; k < n;k++) {
if (judge(i, j, k) && judge(j, i, k) && judge(k, i, j)) {
num++;
}
}
}
}
printf("%d\n",num);
}
return ;
}
FZOJ Problem 2110 Star的更多相关文章
- ACM: FZU 2110 Star - 数学几何 - 水题
FZU 2110 Star Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Pr ...
- FZOJ Problem 2219 StarCraft
...
- Codeforces Round #427 (Div. 2) Problem C Star sky (Codeforces 835C) - 前缀和
The Cartesian coordinate system is set in the sky. There you can see n stars, the i-th has coordinat ...
- FZOJ Problem 2150 Fire Game
...
- FZOJ Problem 2148 Moon Game
Proble ...
- FZOJ Problem 2107 Hua Rong Dao
...
- FZOJ Problem 2103 Bin & Jing in wonderland
...
- FZU 2110 Star
简单暴力题,读入%lld会WA,%I64d能过. #include<cstdio> #include<cstring> #include<cmath> #inclu ...
- Codeforces Round #427 (Div. 2) [ C. Star sky ] [ D. Palindromic characteristics ] [ E. The penguin's game ]
本来准备好好打一场的,然而无奈腹痛只能带星号参加 (我才不是怕被打爆呢!) PROBLEM C - Star sky 题 OvO http://codeforces.com/contest/835/p ...
随机推荐
- python之文件操作的初识
1. 操作文件 1.1 操作的方法 f = open("文件路径",mode="模式",encoding="编码") open() # 调用 ...
- JavaScript -- DOM事件
什么是事件 事件就是文档或浏览器窗口中发生的一些特定的交互瞬间.比如你在网页上见到的鼠标点击一个按钮,按钮的颜色发生了变化,就是因为这个标签绑定了点击事件 鼠标事件 onload:页面加载时触发 on ...
- Makefile 编写实例
make命令常用的三个选项: 1.-k:它的作用是让make命令在发现错误的时候仍然继续执行.我们可以利用这个选项在一次操作中发现未编译成功的源文件. 2.-n:它的作用是让make命令输出将要执行的 ...
- java,求1-100之和。
package study01; public class TestWhile { public static void main(String[] args) { int sum = 0; int ...
- ubuntu 16.04下如何打造 sublime python编程环境
一.安装python3 ubuntu自身是安装python2的,例如在ubuntu 16.04中安装的就是python2.7.但我想在python3的环境下进行开发所以就要安装python3. ...
- Applied Nonparametric Statistics-lec8
Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/11 additive model value = t ...
- AD采样求平均STM32实现
iADC_read(, &u16NTC_1_Sample_Val_ARR[]); == ui8FirstSampleFlag) { ; i<; i++) { u16NTC_1_Sampl ...
- Divisibility by 25 CodeForces - 988E
You are given an integer nn from 11 to 10181018 without leading zeroes. In one move you can swap any ...
- poj-2533 longest ordered subsequence(动态规划)
Time limit2000 ms Memory limit65536 kB A numeric sequence of ai is ordered if a1 < a2 < ... &l ...
- 官网下载MySQL
1)首先我们访问MySQL官网https://dev.mysql.com/,然后如下 2)我们向下拉取滚动条,来到如下界面,选择Source Code 3)向下拉取滚动条,来到如下界面,操作如下: 4 ...