제출 #310098

#제출 시각아이디문제언어결과실행 시간메모리
310098TruaShamuMobile (BOI12_mobile)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <iomanip> using namespace std; #define x first #define y second using namespace std; pair<long long, long long> p[1000000]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, len; cin >> n >> len; for (int i = 0; i < n; i++) cin >> p[i].x >> p[i].y; double l = 1, r = 5e8; while (r - l > 1e-3) { double mid = (l + r) / 2, curr = 0; for (int i = 0; i < n; i++) { double delta = sqrt(mid * mid - p[i].y * p[i].y); double a = p[i].x - delta, b = p[i].x + delta; if (a <= curr) curr = max(curr, b); } if (curr >= len) r = mid; else l = mid; } cout << fixed << std::setprecision(4) << l; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

mobile.cpp: In function 'int main()':
mobile.cpp:21:28: error: 'sqrt' was not declared in this scope
   21 |             double delta = sqrt(mid * mid - p[i].y * p[i].y);
      |                            ^~~~