标签:clear double sep format define rmi axis nes result
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 2199 | Accepted: 1004 |
Description
Input
Output
Sample Input
2 30 50 90 20 40 180 30 40 96 20 20 150
Sample Output
20.0000 50.0000 7.0610 42.4110
Source
/* * @Author: Lyucheng * @Date: 2017-08-06 10:53:59 * @Last Modified by: Lyucheng * @Last Modified time: 2017-08-06 22:23:41 */ /* 题意:给你两个相对于一点的方向和坐标,让你求这点的坐标 思路:就是求两个直线的交点 */ #include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> #include <vector> #include <queue> #include <set> #include <map> #include <string> #include <math.h> #include <stdlib.h> #include <time.h> #define PI 3.141592653589793238 using namespace std; int n; double x,y; int x1,x2,y1,y2; double K1,K2; int deg1,deg2; double Change(int deg){ return (double)( ( (450-deg)%180 )*1.0 ); } int main(){ // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); scanf("%d",&n); while(n--){ scanf("%d%d%d",&x1,&y1,°1); scanf("%d%d%d",&x2,&y2,°2); K1=tan(Change(deg1)/180*PI); K2=tan(Change(deg2)/180*PI); x=(y2-y1-x2*K2+x1*K1)/(K1-K2); y=((x2-x1)*K1*K2+y1*K2-y2*K1)/(K2-K1); printf("%.4f %.4f\n",x,y); } return 0; }
标签:clear double sep format define rmi axis nes result
原文地址:http://www.cnblogs.com/wuwangchuxin0924/p/7296262.html