結果

問題 No.239 にゃんぱすー
ユーザー 小指が強い人
提出日時 2015-11-09 20:58:46
言語 Ruby
(3.4.1)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-09-13 14:15:27
合計ジャッジ時間 4,595 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:24: warning: `elsif' at the end of line without an expression
Main.rb:25: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

n = gets.to_i
a = Array.new(n){ [] }
n.times do |i|
    a[i] = gets.to_s.split
end
c = Array.new(n, 0)
n.times do |i|
    n.times do |j|
        if a[j][i] == "nyanpass"
            c[i] += 1
        end
    end
end
count = 0
id = -1
n.times do |i|
    if c[i] == n - 1
        id = i
        count += 1
    end
end
if count == 1
    puts id + 1
elsif
    puts -1
end
0