結果
問題 | No.48 ロボットの操縦 |
ユーザー |
|
提出日時 | 2015-05-26 16:36:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 265 bytes |
コンパイル時間 | 242 ms |
コンパイル使用メモリ | 33,760 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 18:21:16 |
合計ジャッジ時間 | 967 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | int x, y, l; scanf("%d%d%d", &x, &y, &l); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio> #include <algorithm> using namespace std; int main(void) { int x, y, l; scanf("%d%d%d", &x, &y, &l); int res = (abs(x)+l-1) / l + (abs(y)+l-1) / l; if(y < 0) { res += 2; } else if(x != 0) { res += 1; } printf("%d\n", res); return 0; }