結果

問題 No.509 塗りつぶしツール
ユーザー koba-e964koba-e964
提出日時 2017-04-28 23:28:25
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 259 bytes
コンパイル時間 44 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-09-13 18:35:40
合計ジャッジ時間 3,628 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.chomp
tot = 2
tot2 = 1
qq  = [3,1,1,1,3,1,3,1,4,3]
qq2 = [3,2,2,2,3,2,3,2,4,3]
all1 = true
for c in n.split('')
  tot += qq[c.ord - 48]
  all1 &= qq[c.ord - 48] == 1
  tot2 += qq2[c.ord - 48]
end
if all1
  tot2 = [tot2, n.size + 2].min
end
puts tot2
0