結果
問題 |
No.172 UFOを捕まえろ
|
ユーザー |
![]() |
提出日時 | 2015-03-27 00:42:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 574 bytes |
コンパイル時間 | 159 ms |
コンパイル使用メモリ | 30,336 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-29 01:17:38 |
合計ジャッジ時間 | 931 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 4 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:20:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | scanf("%d %d %lf", &X, &Y, &R); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
// Wrongri-La Shower // 45度回転 #include<cstdio> #include<cmath> typedef long long ll; const double EPS = 1e-9; int X, Y; double R; bool can(int k){ return X-R > -k && k > X+R && Y-R > -k && k > Y+R; } int main(){ scanf("%d %d %lf", &X, &Y, &R); { int x = X + Y, y = X - Y; X = x; Y = y; R *= std::sqrt(2); } int lb = X + Y, ub = 252521; while(ub - lb > 1){ int mid = (lb+ub) / 2; if(can(mid)){ ub = mid; }else{ lb = mid; } } printf("%d\n", ub); }