Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我的哪里错啦,一直WA??#include<iostream> #include<cmath> #include<vector> #include<iomanip> using namespace std; struct item { int x1; int y1; int deg1; int x2; int y2; int deg2; }; int main() { const double pi=2*asinl(1.0); int n; float a,b; cin>>n; vector<item> array(n); for(int i=0;i<n;i++) { cin>>array[i].x1>>array[i].y1>>array[i].deg1; cin>>array[i].x2>>array[i].y2>>array[i].deg2; } float k1,k2; for(int j=0;j<n;j++) { k1=tan((450-array[j].deg1)*pi/180); k2=tan((450-array[j].deg2)*pi/180); a = (k1*array[j].x1 - k2*array[j].x2 - array[j].y1 + array[j].y2)/(k1 - k2); b = (k1*k2*(array[j].x1 - array[j].x2) + k1*array[j].y2 - k2*array[j].y1)/(k1 - k2); cout << fixed << setprecision(4)<<a<<" "<<b<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator