結果

問題 No.63 ポッキーゲーム
ユーザー yu0912yu0912
提出日時 2020-07-23 16:25:38
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 590 bytes
コンパイル時間 46 ms
コンパイル使用メモリ 5,340 KB
実行使用メモリ 42,396 KB
最終ジャッジ日時 2023-09-05 22:24:17
合計ジャッジ時間 3,575 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
42,192 KB
testcase_01 AC 77 ms
42,216 KB
testcase_02 AC 77 ms
42,304 KB
testcase_03 AC 76 ms
42,192 KB
testcase_04 AC 76 ms
42,228 KB
testcase_05 AC 77 ms
42,040 KB
testcase_06 AC 77 ms
42,132 KB
testcase_07 AC 76 ms
42,048 KB
testcase_08 AC 76 ms
42,264 KB
testcase_09 AC 76 ms
42,256 KB
testcase_10 AC 76 ms
42,256 KB
testcase_11 AC 76 ms
42,208 KB
testcase_12 AC 77 ms
42,052 KB
testcase_13 AC 78 ms
42,396 KB
testcase_14 AC 75 ms
42,108 KB
testcase_15 AC 74 ms
42,176 KB
testcase_16 AC 75 ms
42,012 KB
testcase_17 AC 76 ms
42,136 KB
testcase_18 AC 78 ms
42,036 KB
testcase_19 AC 75 ms
42,108 KB
testcase_20 AC 75 ms
42,128 KB
testcase_21 AC 75 ms
42,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function main(input = ``) {
  let lines = input.split('\n');

  let [totalLength, unitLength] = lines[0]
    .split(' ')
    .map((val) => parseInt(val));

  totalLength / (unitLength * 2);

  if (totalLength % (unitLength * 2) === 0) {
    return (totalLength / (unitLength * 2) - 1) * unitLength;
  } else {
    return Math.floor(totalLength / (unitLength * 2)) * unitLength;
  }
}

const { readFileSync, existsSync } = require('fs');
const stdin = '/dev/stdin';

if (existsSync(stdin)) {
  const input = readFileSync(stdin, 'utf8');
  console.log(main(input));
}

module.exports = main;
0