結果

問題 No.920 あかあお
ユーザー はとばねぇはとばねぇ
提出日時 2019-12-06 00:27:51
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 41 ms
コンパイル使用メモリ 5,272 KB
実行使用メモリ 42,472 KB
最終ジャッジ日時 2023-08-03 03:34:51
合計ジャッジ時間 2,212 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
42,416 KB
testcase_01 AC 72 ms
42,208 KB
testcase_02 AC 70 ms
42,356 KB
testcase_03 AC 70 ms
42,472 KB
testcase_04 AC 69 ms
42,328 KB
testcase_05 AC 71 ms
42,208 KB
testcase_06 AC 74 ms
42,252 KB
testcase_07 AC 78 ms
42,248 KB
testcase_08 AC 73 ms
42,232 KB
testcase_09 AC 70 ms
42,220 KB
testcase_10 AC 71 ms
42,232 KB
testcase_11 AC 71 ms
42,232 KB
testcase_12 AC 70 ms
42,200 KB
testcase_13 AC 72 ms
42,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Answer {
  constructor(input) {
    const data = input.trim().split(' ');
    this.X = Number(data[0]);
    this.Y = Number(data[1]);
    this.Z = Number(data[2]);
  }

  main() {
    let count = 0;
    count += this.X > this.Y ? this.Y : this.X;
    let diff = Math.abs(this.X - this.Y);
    if(this.Z >= diff) {
      count += diff;
      count += Math.floor((this.Z - diff)/2);
    }else {
      count += this.Z;
    }
    this.dest(count);
  }

  dest(ans) {
    console.log(ans);
  }
}

new Answer(require('fs').readFileSync('/dev/stdin', 'utf-8')).main();
0