結果

問題 No.48 ロボットの操縦
ユーザー kazutaka-machidakazutaka-machida
提出日時 2023-07-07 17:17:33
言語 TypeScript
(5.4.3)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 470 bytes
コンパイル時間 7,784 ms
コンパイル使用メモリ 257,168 KB
実行使用メモリ 44,132 KB
最終ジャッジ日時 2023-09-28 18:02:27
合計ジャッジ時間 10,996 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
42,028 KB
testcase_01 AC 79 ms
41,968 KB
testcase_02 AC 79 ms
42,084 KB
testcase_03 AC 80 ms
42,416 KB
testcase_04 AC 79 ms
42,180 KB
testcase_05 AC 79 ms
42,096 KB
testcase_06 AC 79 ms
42,148 KB
testcase_07 AC 80 ms
42,144 KB
testcase_08 AC 80 ms
41,960 KB
testcase_09 AC 81 ms
44,132 KB
testcase_10 AC 81 ms
42,124 KB
testcase_11 AC 82 ms
42,172 KB
testcase_12 AC 82 ms
42,084 KB
testcase_13 AC 80 ms
42,236 KB
testcase_14 AC 79 ms
41,924 KB
testcase_15 AC 80 ms
42,400 KB
testcase_16 AC 81 ms
42,144 KB
testcase_17 AC 81 ms
42,184 KB
testcase_18 AC 81 ms
42,012 KB
testcase_19 AC 79 ms
41,956 KB
testcase_20 AC 79 ms
41,968 KB
testcase_21 AC 80 ms
42,088 KB
testcase_22 AC 79 ms
42,132 KB
testcase_23 AC 80 ms
42,156 KB
testcase_24 AC 79 ms
42,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input: string) {
  const inputs = input.split("\n");
  const X = Math.abs(Number(inputs[0]))
  const Y = Number(inputs[1])
  const L = Number(inputs[2])
  
  let count = 0
  
  if (Y != 0) {
  	count += Math.ceil(Math.abs(Y)/L)
  	if (X == 0 && Y < 0) {
  		count += 2
  	} else if (Y < 0) {
  		count += 1
  	}
  }
  if (X != 0) {
  	count += 1
	count += Math.ceil(X/L)
  }
  
  console.log(count)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0