⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1964.cpp

📁 这是哈尔滨工业大学acmOJ的源代码
💻 CPP
字号:
/*  This Code is Submitted by wywcgs for Problem 1964 on 2006-08-09 at 10:18:20 */ 
#include <cstdio>
#include <cmath>

const int V = 200;

int main()
{
	int t, T, i, j;
	double x[3], y[3], e[3], d[3];
	
	scanf("%d", &T);
	for(t = 0; t < T; t++) {
		for(i = 0; i < 3; i++) scanf("%lf %lf", &x[i], &y[i]);
		for(i = 0; i < 3; i++) e[i] = hypot(x[i]-x[(i+1)%3], y[i]-y[(i+1)%3]);
		for(i = 0; i < 3; i++) {
			double a = e[(i+1)%3], b = e[(i+2)%3], c = e[i];
			double cosd = (a*a+b*b-c*c)/(2*a*b);
			d[i] = 2*acos(cosd);
		}
		for(i = 3; i <= V; i++) {
			double sd = 2*M_PI/i;
			int cv = 0;
			for(j = 0; j < 3; j++) cv += (int)(d[j]/sd+1e-5);
			if(cv == i) break;
		}
		printf("%d\n", i);
	}
	
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -