結果
| 問題 |
No.112 ややこしい鶴亀算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-11 23:15:31 |
| 言語 | JavaScript (node v23.5.0) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 5,000 ms |
| コード長 | 396 bytes |
| コンパイル時間 | 64 ms |
| コンパイル使用メモリ | 6,824 KB |
| 実行使用メモリ | 39,552 KB |
| 最終ジャッジ日時 | 2024-10-13 01:12:00 |
| 合計ジャッジ時間 | 2,488 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
const lines = require('fs')
.readFileSync('/dev/stdin', 'utf-8')
.trim().split('\n').values();
const N = Number(lines.next().value);
const a = lines.next().value.split(' ').map(x => Number(x));
const max = Math.max(...a);
let 鶴 = a.reduce((a, x) => a + (x === max ? 1 : 0), 0);
let 亀 = N - 鶴;
if (鶴 * 2 + 亀 * 4 !== max + 2) {
[鶴, 亀] = [亀, 鶴];
}
console.log(鶴, 亀);