結果

問題 No.290 1010
ユーザー bal4ubal4u
提出日時 2019-04-14 21:07:33
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 622 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 29,156 KB
実行使用メモリ 5,972 KB
最終ジャッジ日時 2023-10-19 16:55:17
合計ジャッジ時間 6,613 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// yukicoder: No.290 1010
// 2019.4.14 bal4u

#include <stdio.h>

#define gc() getchar()
int in()    // 非負整数の入力
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

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

char S[1000005];

int main()
{
	int N;
	char *p;
	
	N = in(), ins(S);
	if (N <= 1) puts("NO");
	else if (N >= 4) puts("YES");
	else {
		p = S + 1; while (*p) {
			if (*p == *(p - 1)) break;
		}
		puts(*p ? "YES" : "NO");
	}
	return 0;
}
0