UESTC 1033 Marineking wilyin
来源:互联网 发布:淘宝csv数据怎么制作 编辑:程序博客网 时间:2024/06/11 06:35
Marineking wilyin
Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)
There are three marines in wilyin's base. Their positions form a right triangle.Now wilyin get another marine,he want to put it on some place to
form a rectangle with the former three marines.where should he put it on?
Input
The first line of the input contains an integer
integers
You may assume the absolute value of coordinate not exceed
Output
For each case, print the coordinate of the forth marine on a single line.
Sample input and output
20 0 1 0 0 10 1 0 -1 1 0
1 1-1 0
My Solution
推导一下数学公示,解决数学问题
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;//用到了白书数据结构-例题6-5中,我自己学到的小技巧。void jiaohuan(int &x1,int &y1,int &x2,int &y2,int &x3,int &y3){ int x12=x1-x2,y12=y1-y2,x13=x1-x3,y13=y1-y3,x23=x2-x3,y23=y2-y3; if((x12*x13+y12*y13)==0) return; else if((x12*x23+y12*y23)==0) {swap(x1,x2);swap(y1,y2);} else {swap(x1,x3);swap(y1,y3);}}int main(){ int T,x1,y1,x2,y2,x3,y3,x,y;//令x1,y1为直角的顶点 scanf("%d",&T); while(T--){ scanf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3);//cout<<x1<<y1<<x2<<y2; jiaohuan(x1,y1,x2,y2,x3,y3); x=x2+x3-x1; y=y2+y3-y1; if(T) printf("%d %d\n",x,y); else printf("%d %d",x,y); } return 0;}
谢谢
0 0
- UESTC 1033 Marineking wilyin
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- sublist分组list模拟代码
- TECHNIQUES(技术)
- Educational Codeforces Round 2_B. Queries about less or equal elements
- 适配器模式
- HDU 2955 Robberies
- UESTC 1033 Marineking wilyin
- 10007---注入属性值细节
- vim的跳转
- 再次唠叨linux中的strings命令
- UESTC 1012 Ladygod 任意进制的转化
- [Swoole入门]-异步毫秒定时器
- Codeforces 600B Queries about less or equal elements(二分查找)
- 排序算法之插入排序
- 杭电ACM 1012 1013 1014