結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2018-09-30 00:09:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 599 bytes |
コンパイル時間 | 495 ms |
コンパイル使用メモリ | 66,484 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-12 08:54:59 |
合計ジャッジ時間 | 1,261 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <algorithm> #include <iostream> #include <string> using namespace std; static void setup() { cin.tie(0); ios::sync_with_stdio(false); } static void run() { int x, y, l; cin >> x >> y >> l; auto count = 0; if (y < 0) count += 2; // 北から南に方向転換 count += (abs(y) + (l - 1)) / l; if (x != 0) { if (y >= 0) count += 1; // 東か北に方向転換、 y<0 の場合は回転済み count += (abs(x) + (l - 1)) / l; } cout << count << endl; } int main(int argc, char **argv) { setup(); run(); return 0; }