Advertisement
Malinovsky239

УРКОП 2011: L

Oct 22nd, 2011
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <cstdio>
  2. #include <iostream>
  3. #include <algorithm>
  4.  
  5. #define N 602
  6. #define eps (1e-7)
  7.  
  8. using namespace std;
  9.  
  10. double d[N];
  11.  
  12. int main() {
  13.     int n, m;
  14.     cin >> n;
  15.  
  16.     d[0] = -0.005;
  17.     for (int i = 1; i <= n; i++) {
  18.         cin >> d[i];
  19.         d[i] *= 0.001;
  20.     }
  21.     cin >> m;
  22.     for (int i = n + 1; i <= n + m; i++) {
  23.         cin >> d[i];
  24.         d[i] *= 0.001;
  25.         d[i] -= 0.008;
  26.     }
  27.     sort(d, d + n + m + 1);
  28.     double res;
  29.  
  30.     d[n + m + 1] = 1e9;
  31.  
  32.     for (int i = 0; i <= n + m; i++) {
  33.         if (d[i + 1] - d[i] - 0.013 > eps || abs(d[i + 1] - d[i] - 0.013) < eps ) {        
  34.             res = (d[i] + 0.005) * 180;            
  35.             break;
  36.         }      
  37.     }
  38.  
  39.     cout.precision(6); 
  40.     cout << fixed << res;
  41.     return 0;
  42. }
  43.  
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement