Topic Portal
Test instructions: Tell each rectangle the length of the edge, they are close, ask from the top down, there are a few can see.
Analysis: Using the online wretched method, the edge length as the left end to the center of the distance, so as to avoid the accuracy problem. The left and right ends of each rectangle are then first calculated, and then if overridden, updates the endpoint to the overridden location. Finally, the updated left endpoint small less right operand endpoint, which can be seen.
/************************************************* author:running_time* Created time:2015/10/28 Wednesday 11:48:32* Fi Le Name:P oj_3347.cpp ************************************************/#include <cstdio> #include < algorithm> #include <iostream> #include <sstream> #include <cstring> #include <cmath># Include <string> #include <vector> #include <queue> #include <deque> #include <stack># Include <list> #include <map> #include <set> #include <bitset> #include <cstdlib> #include <ctime>using namespace std; #define Lson L, Mid, RT << 1#define Rson mid + 1, R, RT << 1 | 1typedef long ll;const int N = 1e5 + 10;const int INF = 0x3f3f3f3f;const int MOD = 1e9 + 7;const Double EPS = 1e-10;c Onst Double PI = ACOs ( -1.0); struct Square {int L, r, Len;} S[55];int Main (void) {int n; while (scanf ("%d", &n) = = 1) {if (!n) break; for (int i=1; i<=n; ++i) {scanf ("%d", &s[i].len); S[I].L = 0; for (int j=1; j<i; ++j) {int tmp; if (S[i].len <= s[j].len) {tmp = S[J].L + S[j].len + s[i].len; } else {tmp = S[J].L + S[j].len * 3-s[i].len; } if (tmp > S[I].L) S[I].L = tmp; } S[I].R = S[i].l + S[i].len * 2; } for (int i=2, i<=n; ++i) {for (int j=1; j<i; ++j) {if (S[j].len < S[i].le n && s[j].r > s[i].l) {s[j].r = S[I].L; } else if (S[j].len > S[i].len && s[j].r > S[i].l) {s[i].l = S[J].R; }}} for (int i=1; i<=n; ++i) {if (S[i].l < S[I].R) { printf ("%d", I); }} puts (""); } //cout << "time Elapsed:" << 1.0 * Clock ()/clocks_per_sec << "s.\n"; return 0;}
Simple geometry (segment overlay) POJ 3347 Kadj Squares