結果

問題 No.48 ロボットの操縦
ユーザー intercept6intercept6
提出日時 2020-09-10 15:34:00
言語 TypeScript
(5.4.3)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 496 bytes
コンパイル時間 11,061 ms
コンパイル使用メモリ 257,600 KB
実行使用メモリ 42,572 KB
最終ジャッジ日時 2023-08-24 22:55:15
合計ジャッジ時間 11,469 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
42,260 KB
testcase_01 AC 77 ms
42,236 KB
testcase_02 AC 77 ms
42,368 KB
testcase_03 AC 77 ms
42,492 KB
testcase_04 AC 78 ms
42,288 KB
testcase_05 AC 77 ms
42,396 KB
testcase_06 AC 77 ms
42,236 KB
testcase_07 AC 76 ms
42,332 KB
testcase_08 AC 77 ms
42,244 KB
testcase_09 AC 76 ms
42,248 KB
testcase_10 AC 76 ms
42,256 KB
testcase_11 AC 75 ms
42,328 KB
testcase_12 AC 76 ms
42,332 KB
testcase_13 AC 76 ms
42,272 KB
testcase_14 AC 76 ms
42,348 KB
testcase_15 AC 77 ms
42,572 KB
testcase_16 AC 77 ms
42,232 KB
testcase_17 AC 78 ms
42,252 KB
testcase_18 AC 78 ms
42,152 KB
testcase_19 AC 76 ms
42,156 KB
testcase_20 AC 76 ms
42,248 KB
testcase_21 AC 77 ms
42,232 KB
testcase_22 AC 77 ms
42,176 KB
testcase_23 AC 78 ms
42,320 KB
testcase_24 AC 77 ms
42,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import { readFileSync } from 'fs';

function Main(input: string) {
  const data = input.split('\n');

  const positionX = parseInt(data[0]);
  const positionY = parseInt(data[1]);
  const distance = parseInt(data[2]);

  const distanceX = Math.ceil(Math.abs(positionX) / distance);
  const distanceY = Math.ceil(Math.abs(positionY) / distance);
  const turn = positionY < 0 ? 2 : positionX !== 0 ? 1 : 0;

  console.log(distanceX + distanceY + turn);
}

Main(readFileSync('/dev/stdin', 'utf8'));
0