結果

問題 No.239 にゃんぱすー
ユーザー yn
提出日時 2016-06-09 23:31:30
言語 Ruby
(3.4.1)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-10-09 08:13:05
合計ジャッジ時間 5,026 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:5: warning: assigned but unused variable - j
Syntax OK

ソースコード

diff #

n = gets.to_i
cnt = Array.new(n, 0)
num = 0
idx = -1
for j in 0..n-1
  a = gets.chomp.split(" ")
  for i in 0..n-1
    if a[i] == 'nyanpass' then
      cnt[i] += 1
    end
  end
end

for i in 0..n-1
  if cnt[i] == n-1 then
    idx = i
    num += 1
  end
end


if num == 1 then
  puts(idx + 1)
else
  puts(-1)
end
0