結果

問題 No.73 helloworld
ユーザー yuruhiyayuruhiya
提出日時 2020-07-22 14:11:06
言語 Crystal
(1.11.2)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 396 bytes
コンパイル時間 20,939 ms
コンパイル使用メモリ 264,280 KB
実行使用メモリ 4,968 KB
最終ジャッジ日時 2023-09-13 11:15:51
合計ジャッジ時間 20,110 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,872 KB
testcase_01 AC 3 ms
4,820 KB
testcase_02 AC 3 ms
4,820 KB
testcase_03 AC 3 ms
4,792 KB
testcase_04 AC 3 ms
4,876 KB
testcase_05 AC 2 ms
4,916 KB
testcase_06 AC 3 ms
4,784 KB
testcase_07 AC 3 ms
4,816 KB
testcase_08 AC 3 ms
4,900 KB
testcase_09 AC 3 ms
4,968 KB
testcase_10 AC 3 ms
4,844 KB
testcase_11 AC 3 ms
4,896 KB
testcase_12 AC 3 ms
4,772 KB
testcase_13 AC 3 ms
4,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

require "big"
a = (1..26).map { read_line.to_big_i }
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(1.to_big_i) { |acc, c|
  acc * a[c - 'a']
} * (2.to_big_i...a['l' - 'a']).max_of { |cnt|
  cnt * (cnt - 1) // 2 * (a['l' - 'a'] - cnt)
} * (1.to_big_i..a['o' - 'a']).max_of { |cnt|
  cnt * (a['o' - 'a'] - cnt)
}
0