結果

問題 No.342 一番ワロタww
ユーザー kotatsugame
提出日時 2018-06-15 07:11:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 613 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 66,048 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 13:38:04
合計ジャッジ時間 1,139 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
string s;
bool c(char a,char b,char c)
{
	string t="w";
	return a==t[0]&&b==t[1]&&c==t[2];
}
main()
{
	cin>>s;
	int start=0;
	while(start<s.size()&&c(s[start],s[start+1],s[start+2]))start+=3;
	for(int k=s.size()/3*3;k>0;k-=3)
	{
		bool f=0;
		for(int i=start;i+k<=s.size();i+=3)
		{
			bool l=1;
			for(int j=0;j<k/3;j++)
			{
				l&=c(s[i+j*3],s[i+j*3+1],s[i+j*3+2]);
			}
			if(l)
			{
				f=1;
				int first=i;
				i-=3;
				while(i>=0&&!c(s[i],s[i+1],s[i+2]))i-=3;
				cout<<s.substr(i+3,first-i-3)<<endl;
				i=first;
			}
		}
		if(f)return 0;
	}
	cout<<""<<endl;
}
0