結果

問題 No.342 一番ワロタww
ユーザー bal4ubal4u
提出日時 2019-05-05 21:39:43
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 935 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 28,404 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-08 09:54:33
合計ジャッジ時間 1,739 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 0 ms
4,380 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 0 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 0 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 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