結果

問題 No.342 一番ワロタww
ユーザー kotatsugame
提出日時 2018-08-23 09:46:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 830 bytes
コンパイル時間 866 ms
コンパイル使用メモリ 66,432 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 17:02:52
合計ジャッジ時間 1,761 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:18:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   18 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
string s;
struct myc{
	char c[3];
	bool check(){
		return c[0]==-17&&c[1]==-67&&c[2]==-105;
	}
	void print(){
		if(c[1]<0){
			string t={c[0],c[1],c[2]};
			cout<<t;
		}
		else cout<<c[0];
	}
};
myc a[114514];
main()
{
	cin>>s;
	int cnt=0;
	for(int i=0;i<s.size();)
	{
		if(s[i]<0)a[cnt].c[0]=s[i],a[cnt].c[1]=s[i+1],a[cnt].c[2]=s[i+2],i+=3;
		else a[cnt].c[0]=s[i],i++;
		cnt++;
	}
	int start=0;
	while(start<cnt&&a[start].check())start++;
	for(int k=cnt;k>0;k--)
	{
		bool f=0;
		for(int i=start;i+k<=cnt;i++)
		{
			bool l=1;
			for(int j=0;j<k;j++)
			{
				l&=a[i+j].check();
			}
			if(l)
			{
				f=1;
				int first=i;
				i--;
				while(i>=0&&!a[i].check())i--;
				for(int k=i+1;k<first;k++)a[k].print();
				cout<<endl;
				i=first;
			}
		}
		if(f)return 0;
	}
	cout<<""<<endl;
}
0