結果

問題 No.920 あかあお
ユーザー はとばねぇ
提出日時 2019-12-06 00:27:51
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 6,948 KB
実行使用メモリ 39,424 KB
最終ジャッジ日時 2024-10-13 01:29:05
合計ジャッジ時間 1,594 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

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