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之道13
看代码分析结果 func_list = [] for i in range(10): func_list.append(lambda :i) v1 = func_list[0]() v2 = func ...
- LiteIDE 错误: go build xxxxxx: no non-test Go files in xxxx
问题 c:/go/bin/go.exe build [C:/Users/Administrator/Desktop/go] go build _/C_/Users/Administrator/Desk ...
- d3.js--02(data和datum原理)
原文链接: http://d3.decembercafe.org/pages/lessons/3.html 解析一下data和datum原理: datum():绑定一个数据到选择集上 data():绑 ...
- EditPlus 比较完整的快捷键记录
FileFtpUpload Ctrl+Shift+S 上传文件到FTP 服务器 FileNew Ctrl+N 新建普通的文本文档 FileNewHtml Ctrl+Shift+N 创建一个空白的 HT ...
- python多进程并发进程池Pool
简介: python中的多进程主要使用到 multiprocessing 这个库.低版本python这个库在使用 multiprocessing.Manager().Queue时会出问题,建议大家升级 ...
- leetcode-25-exercise_string&array
14. Longest Common Prefix Write a function to find the longest common prefix string amongst an array ...
- leetcode-17-BST
530. Minimum Absolute Difference in BST Given a binary search tree with non-negative values, find th ...
- [转] vuex最简单、最直白、最全的入门文档
前言 我们经常用element-ui做后台管理系统,经常会遇到父组件给子组件传递数据,下面一个简单的例子,点击按钮,把弹框显示变量数据通过子组件的props属性传递,子组件通过$emit事件监听把数据 ...
- EXCEL宏做数据拆分
用处:将大容量的EXCEL工作簿分解成若干个小的工作簿 Sub aa() For i = 1 To 8 Set nb = Workbooks.Add nb.SaveAs Filename:=ThisW ...
- loj2182 「SDOI2015」寻宝游戏
参考这里 #include <iostream> #include <cstdio> #include <set> using namespace std; typ ...