結果

問題 No.405 ローマ数字の腕時計
ユーザー mesh1nekomesh1neko
提出日時 2016-08-27 15:43:37
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 639 bytes
コンパイル時間 49 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 42,360 KB
最終ジャッジ日時 2023-09-21 00:18:27
合計ジャッジ時間 4,030 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
42,136 KB
testcase_01 AC 76 ms
42,244 KB
testcase_02 AC 75 ms
42,280 KB
testcase_03 AC 75 ms
42,284 KB
testcase_04 AC 75 ms
42,144 KB
testcase_05 AC 74 ms
42,352 KB
testcase_06 AC 74 ms
42,208 KB
testcase_07 AC 74 ms
42,284 KB
testcase_08 AC 74 ms
42,140 KB
testcase_09 AC 73 ms
42,184 KB
testcase_10 AC 73 ms
42,188 KB
testcase_11 AC 74 ms
42,132 KB
testcase_12 AC 74 ms
42,232 KB
testcase_13 AC 72 ms
42,284 KB
testcase_14 AC 72 ms
42,272 KB
testcase_15 AC 72 ms
42,144 KB
testcase_16 AC 71 ms
42,196 KB
testcase_17 AC 72 ms
42,100 KB
testcase_18 AC 74 ms
42,280 KB
testcase_19 AC 72 ms
42,228 KB
testcase_20 AC 72 ms
42,244 KB
testcase_21 AC 74 ms
42,360 KB
testcase_22 AC 73 ms
42,312 KB
testcase_23 AC 74 ms
42,196 KB
testcase_24 AC 72 ms
42,148 KB
testcase_25 AC 72 ms
42,228 KB
testcase_26 AC 73 ms
42,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

'use strict';

const fs = require('fs');

(function () {
  var watch = ['I','II','III','IIII','V','VI','VII','VIII','IX','X','XI','XII'];
  var rfs   = fs.readFileSync('/dev/stdin', 'utf8');
  var input = rfs.split('\n')[0].split(' ');
  var S1    = input[0];
  var T     = parseInt(input[1]);
  var output;

  var S1Key = Object.keys(watch).filter( (key) => {
    return watch[key] === S1;
  })[0];

  var rotateDeg = (parseInt(S1Key) + T) % 12;

  if (rotateDeg < 0) {
    // 末尾からn番目を参照したいので+1
    output = watch[11 + rotateDeg + 1];
  } else {
    output = watch[rotateDeg];
  }
  console.log(output);
}());
0