Created
October 18, 2013 15:05
-
-
Save msg555/7042935 to your computer and use it in GitHub Desktop.
My judge solution to Overlapping Maps from UChicago's 2013 Invitational Contest.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdio> | |
#include <cassert> | |
#include <cmath> | |
using namespace std; | |
/* | |
X' = ASX + O | |
(AS-I)X+O = 0 | |
*/ | |
#define EPS 1e-9 | |
int main() { | |
for(int t = 1; ; t++) { | |
int W, H, X, Y, S, R; | |
cin >> W >> H >> X >> Y >> S >> R; | |
if(!W) break; | |
double theta = 3.14159265358979 * R / 180; | |
double A[2][2]; | |
A[0][0] = cos(theta) * S / 100 - 1; | |
A[0][1] = -sin(theta) * S / 100; | |
A[1][0] = sin(theta) * S / 100; | |
A[1][1] = cos(theta) * S / 100 - 1; | |
double det = A[0][0] * A[1][1] - A[0][1] * A[1][0]; | |
assert(det > EPS); | |
printf("%.2f %.2f\n", (A[0][1] * Y - A[1][1] * X) / det, | |
(A[1][0] * X - A[0][0] * Y) / det); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment