結果
問題 | No.172 UFOを捕まえろ |
ユーザー | tadanoningen |
提出日時 | 2020-09-19 11:30:13 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 989 bytes |
コンパイル時間 | 699 ms |
コンパイル使用メモリ | 68,352 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 08:54:50 |
合計ジャッジ時間 | 1,578 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 2 ms
5,376 KB |
testcase_14 | AC | 2 ms
5,376 KB |
testcase_15 | AC | 2 ms
5,376 KB |
testcase_16 | AC | 2 ms
5,376 KB |
testcase_17 | AC | 2 ms
5,376 KB |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | AC | 2 ms
5,376 KB |
testcase_20 | AC | 1 ms
5,376 KB |
testcase_21 | AC | 2 ms
5,376 KB |
testcase_22 | AC | 2 ms
5,376 KB |
testcase_23 | AC | 2 ms
5,376 KB |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/cstdlib:77, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ext/string_conversions.h:41, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/basic_string.h:3968, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/string:53, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/locale_classes.h:40, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/ios_base.h:41, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ios:42, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:38, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/iostream:39, from main.cpp:1: In function 'constexpr double std::abs(double)', inlined from 'int main()' at main.cpp:35:18: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/std_abs.h:72:30: warning: 'dist' may be used uninitialized [-Wmaybe-uninitialized] 72 | { return __builtin_fabs(__x); } | ^ main.cpp: In function 'int main()': main.cpp:11:12: note: 'dist' was declared here 11 | double dist; | ^~~~
ソースコード
#include<iostream> #include<cmath> #include<string> using namespace std; int main(){ double x,y,r; cin >> x >> y >> r; double dist; if(x > 0 && y > 0){ dist = ceil(x + y + sqrt(2)*r); }else if(x < 0 && y > 0){ dist = -x + y + sqrt(2)*r; if(dist > 0) dist = ceil(dist); else if(dist < 0) dist = floor(dist); }else if(x < 0 && y < 0){ dist = floor(x + y - sqrt(2)*r); }else if(x > 0 && y < 0){ dist = -x + y - sqrt(2)*r; if(dist > 0) dist = ceil(dist); else if(dist < 0) dist = floor(dist); }else if(x > 0 && y == 0){ dist = ceil(x + sqrt(2)*r); }else if(x < 0 && y == 0){ dist = floor(x - sqrt(2)*r); }else if(x == 0 && y > 0){ dist = ceil(y + sqrt(2)*r); }else if(x == 0 && y < 0){ dist = floor(y - sqrt(2)*r); }else if(x == 0 && y == 0){ dist = ceil(sqrt(2)*r); } int ans = abs(dist); cout << ans << endl; return 0; }