B. Eight Point Sets
来源:互联网 发布:mac上邮箱怎么设置 编辑:程序博客网 时间:2024/04/29 20:05
解题说明:给你满足x1<x2<x3, y1<y2<y3, 然后用这六个数组成九个点,去掉(x2,y2)点,剩下的八个点是否满足条件。首先对这八个点排序,然后按照从中找到x1,x2,x3,y1,y2,y3,判断是否满足条件。
#include<stdio.h>#include<math.h>#include<string.h>#include<stdlib.h>int compare(const void *a,const void *b){ return (*(int *)a-*(int *)b);}int main(){ int x[8],y[8],i,j; for(i=0;i<8;i++) { scanf("%d %d",&x[i],&y[i]); } for(i=0;i<8;i++) { for(j=i+1;j<8;j++) { if(x[i]==x[j]&&y[i]==y[j]) { printf("ugly"); return 0; } else {continue;}} } qsort(x,8,sizeof(int),compare); qsort(y,8,sizeof(int),compare); if(x[1]==x[0]&&x[2]==x[1]&&x[4]==x[3]&&x[7]==x[6]&&x[5]==x[7]&&x[3]>x[0]&&x[6]>x[3]&&y[3]>y[2]&&y[5]>y[4]&&y[4]==y[3]&&y[0]==y[1]&&y[1]==y[2]&&y[6]==y[7]&&y[5]==y[6]&&y[3]!=y[1]) {printf("respectable\n");}else{ printf("ugly\n");}return 0;}
- B. Eight Point Sets
- codeforces 334B. Eight Point Sets
- CodeForces 334B Eight Point Sets
- [Codeforces] 334B - Eight Point Sets
- codeforces #334 B. Eight Point Sets
- Eight Point Sets
- Eight-point algorithm
- B - Equal Sum Sets
- cf 194 div2 BEight Point Sets
- MATLAB: 3d reconstruction using eight point algorithm
- Codeforce 468B Two Sets
- Codeforces 468B Two Sets
- Codeforces 468B Two Sets
- 477 B. Dreamoon and Sets
- 【CODEFORCES】 B. Dreamoon and Sets
- codeforces 468B Two Sets
- Codeforces 268B Two Sets
- Least-Squares Fitting of Two 3-D Point Sets
- 扔骰子的一道概率题
- C语言中的宏定义
- HDU 4099 Revenge of Fibonacci(高精度+字典树)
- 优化 Flash 性能
- git - 简易指南
- B. Eight Point Sets
- [LeetCode] Remove Duplicate from Sorted Linkded List II
- AJAX 跨域请求 - JSONP获取JSON数据
- OCP-1Z0-052-V8.02-44题
- 关于64位 Ubuntu 13.04 安装Android Studio的一些问题及ADB驱动配置
- C++中private继承
- RPM的安装
- 无线网卡的Master,Managed,ad-hoc,monitor等模式
- dbms_space 显示自动段顾问建议!