結果

問題 No.342 一番ワロタww
コンテスト
ユーザー bal4u
提出日時 2019-05-05 21:39:43
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 935 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 264 ms
コンパイル使用メモリ 38,976 KB
最終ジャッジ日時 2026-02-22 03:17:36
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// yukicoder: No.342 一番ワロタww
// 2019.5.5 bal4u

#include <stdio.h>

#define gc() getchar()
#define pc(c) putchar(c)

void ins(unsigned char *s)  // 文字列の入力 スペース以下の文字で入力終了
{
	do *s = gc();
	while (*s++ > ' ');
	*(s-1) = 0;
}

void outs(unsigned char *s) { while (*s) pc(*s++); }

// w = 0xef 0xbd 0x97
unsigned char S[1000], *s = S;

int isJW(unsigned char *s) {
	return *s == 0xef && *(s+1) == 0xbd && *(s+2) == 0x97;
}

int main()
{
	int w, max;
	unsigned char *S0, *p, *q;
	
	ins(S);
	while (isJW(s)) s += 3;
	S0 = s;
	
	max = 0;
	while (1) {
		w = 0; while (isJW(s)) s += 3, w++;
		if (w > max) max = w;
		if (*s++ == 0) break;
	}
	if (max == 0) { pc('\n'); return 0; }
	
	s = S0, p = s; while (1) {
		if (isJW(s)) {
			q = s;
			w = 0; while (isJW(s)) s += 3, w++;
			if (w == max) {
				*q = 0, outs(p), pc('\n');
			}
			p = s;
		}
		if (*s++ == 0) break;
	}
	return 0;
}
0