結果

問題 No.342 一番ワロタww
ユーザー koyumeishikoyumeishi
提出日時 2016-02-13 01:12:31
言語 Ruby
(3.3.0)
結果
AC  
実行時間 95 ms / 5,000 ms
コード長 1,702 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-04-23 13:19:16
合計ジャッジ時間 2,393 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
12,544 KB
testcase_01 AC 89 ms
12,416 KB
testcase_02 AC 87 ms
12,416 KB
testcase_03 AC 88 ms
12,416 KB
testcase_04 AC 88 ms
12,416 KB
testcase_05 AC 88 ms
12,544 KB
testcase_06 AC 88 ms
12,544 KB
testcase_07 AC 90 ms
12,416 KB
testcase_08 AC 89 ms
12,416 KB
testcase_09 AC 89 ms
12,416 KB
testcase_10 AC 91 ms
12,544 KB
testcase_11 AC 89 ms
12,288 KB
testcase_12 AC 88 ms
12,544 KB
testcase_13 AC 91 ms
12,544 KB
testcase_14 AC 91 ms
12,544 KB
testcase_15 AC 89 ms
12,288 KB
testcase_16 AC 92 ms
12,416 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