結果

問題 No.342 一番ワロタww
ユーザー koyumeishikoyumeishi
提出日時 2016-02-12 22:54:56
言語 Ruby
(3.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 570 bytes
コンパイル時間 51 ms
コンパイル使用メモリ 11,932 KB
実行使用メモリ 16,112 KB
最終ジャッジ日時 2023-10-22 03:20:38
合計ジャッジ時間 2,403 ms
ジャッジサーバーID
(参考情報)
judge9 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
16,108 KB
testcase_01 AC 89 ms
16,108 KB
testcase_02 AC 90 ms
16,108 KB
testcase_03 AC 88 ms
16,108 KB
testcase_04 AC 88 ms
16,108 KB
testcase_05 AC 93 ms
16,108 KB
testcase_06 AC 89 ms
16,108 KB
testcase_07 AC 87 ms
16,108 KB
testcase_08 AC 84 ms
16,104 KB
testcase_09 AC 84 ms
16,100 KB
testcase_10 AC 84 ms
16,108 KB
testcase_11 AC 84 ms
16,108 KB
testcase_12 AC 85 ms
16,108 KB
testcase_13 AC 86 ms
16,108 KB
testcase_14 AC 84 ms
16,108 KB
testcase_15 AC 84 ms
16,108 KB
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#using : utf-8
#encoding : utf-8

s = gets.chomp

ans = 0

len = 0
con = false

dot = "w"

arr = Array.new(s.length)

for i in 0...s.length do
	arr[i] = -1
	if s[i] == dot then
		if con == true then
			len += 1
			ans = [ans, len].max
		else
			con = true
			len = 1
			ans = [ans, len].max
		end
		arr[i] = 0
		arr[i-len+1] = len
	else
		len = 0
		con = false
	end
end


for i in 1...s.length do
	if arr[i] > 0 then
		if arr[i] == ans then
			x = i-1
			while x > 0 && s[x-1] != dot do
				x -= 1
			end
			puts s[x, i-x]
		end
	end
end

if ans == 0 then
	puts ""
end
0