結果
問題 | No.832 麻雀修行中 |
ユーザー |
![]() |
提出日時 | 2021-01-24 12:46:55 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 86 ms / 2,000 ms |
コード長 | 770 bytes |
コンパイル時間 | 252 ms |
コンパイル使用メモリ | 7,936 KB |
実行使用メモリ | 13,056 KB |
最終ジャッジ日時 | 2025-01-02 16:08:41 |
合計ジャッジ時間 | 3,890 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 25 |
コンパイルメッセージ
Syntax OK
ソースコード
def check_2x7(a)cnt = (0..4).map { a.count(_1) }cnt == [3, 0, 7, 0, 0]enddef check_3x4(a)flag = true(0...10).each do |i|a[i] -= 3 if a[i] >= 3if a[i] > 0minus = a[i](i...i + 3).each do |j|if j < 10if minus > a[j]flag = falsebreakenda[j] -= minuselseflag = falseendendendendflagenddef check(a)flag = falseflag = true if check_2x7(a.dup)(0...10).each do |i|if a[i] >= 2a[i] -= 2flag = true if check_3x4(a.dup)a[i] += 2endendflagends = gets.chomp.chars.map(&:to_i)a = (0...10).map { s.count(_1) }puts (0...10).select { |i|if i >= 1 && a[i] <= 3a[i] += 1res = check(a.dup)# p [a, res]a[i] -= 1reselsefalseend}