結果

問題 No.73 helloworld
ユーザー yuruhiyayuruhiya
提出日時 2020-07-22 14:11:49
言語 Crystal
(1.11.2)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 362 bytes
コンパイル時間 16,881 ms
コンパイル使用メモリ 256,252 KB
実行使用メモリ 4,492 KB
最終ジャッジ日時 2023-09-13 11:17:33
合計ジャッジ時間 17,680 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,460 KB
testcase_01 AC 2 ms
4,404 KB
testcase_02 AC 2 ms
4,456 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,396 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 3 ms
4,444 KB
testcase_08 AC 2 ms
4,404 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,428 KB
testcase_12 AC 2 ms
4,456 KB
testcase_13 AC 2 ms
4,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a = (1..26).map { read_line.to_i64 }
if "dehrw".chars.any? { |c| a[c - 'a'] < 1 } || a['l' - 'a'] < 3 || a['o' - 'a'] < 2
  puts 0
  exit
end
puts "dehrw".chars.reduce(1i64) { |acc, c|
  acc * a[c - 'a']
} * (2i64...a['l' - 'a']).max_of { |cnt|
  cnt * (cnt - 1) // 2 * (a['l' - 'a'] - cnt)
} * (1i64..a['o' - 'a']).max_of { |cnt|
  cnt * (a['o' - 'a'] - cnt)
}
0