結果

問題 No.342 一番ワロタww
ユーザー koyumeishikoyumeishi
提出日時 2016-02-13 01:12:31
言語 Ruby
(3.3.0)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 1,702 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 11,740 KB
実行使用メモリ 15,444 KB
最終ジャッジ日時 2023-08-05 16:10:28
合計ジャッジ時間 2,482 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,360 KB
testcase_01 AC 83 ms
15,372 KB
testcase_02 AC 84 ms
15,364 KB
testcase_03 AC 84 ms
15,368 KB
testcase_04 AC 86 ms
15,132 KB
testcase_05 AC 84 ms
15,212 KB
testcase_06 AC 84 ms
15,264 KB
testcase_07 AC 83 ms
15,180 KB
testcase_08 AC 82 ms
15,444 KB
testcase_09 AC 83 ms
15,212 KB
testcase_10 AC 84 ms
15,352 KB
testcase_11 AC 84 ms
15,180 KB
testcase_12 AC 83 ms
15,200 KB
testcase_13 AC 83 ms
15,168 KB
testcase_14 AC 82 ms
15,352 KB
testcase_15 AC 84 ms
15,368 KB
testcase_16 AC 82 ms
15,188 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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

入力の文字列 = gets.chomp

最長の連続wの長さ = 0

今見てる連続wの長さ = 0
今見てるwが続いてるか = false

テラワロス = "w"

while 入力の文字列.length > 0 && 入力の文字列[0] == テラワロス do
	入力の文字列 = 入力の文字列[1, 入力の文字列.length-1]
end

💩は日本語で幸運を意味するらしいです = Array.new(入力の文字列.length)

for i in 0...入力の文字列.length do
	💩は日本語で幸運を意味するらしいです[i] = -1
	if 入力の文字列[i] == テラワロス then
		if 今見てるwが続いてるか == true then
			今見てる連続wの長さ += 1
			最長の連続wの長さ = [最長の連続wの長さ, 今見てる連続wの長さ].max
		else
			今見てるwが続いてるか = true
			今見てる連続wの長さ = 1
			最長の連続wの長さ = [最長の連続wの長さ, 今見てる連続wの長さ].max
		end
		💩は日本語で幸運を意味するらしいです[i] = 0
		💩は日本語で幸運を意味するらしいです[i-今見てる連続wの長さ+1] = 今見てる連続wの長さ
	else
		今見てる連続wの長さ = 0
		今見てるwが続いてるか = false
	end
end


for i in 1...入力の文字列.length do
	if 💩は日本語で幸運を意味するらしいです[i] > 0 then
		if 💩は日本語で幸運を意味するらしいです[i] == 最長の連続wの長さ then
			x = i-1
			while x > 0 && 入力の文字列[x-1] != テラワロス do
				x -= 1
			end
			puts 入力の文字列[x, i-x]
		end
	end
end

if 最長の連続wの長さ == 0 then
	puts ""
end
0