結果

問題 No.653 E869120 and Lucky Numbers
ユーザー bal4ubal4u
提出日時 2019-07-20 16:20:08
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 718 bytes
コンパイル時間 1,167 ms
コンパイル使用メモリ 28,160 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 17:29:45
合計ジャッジ時間 2,406 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'ins':
main.c:7:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
    7 | #define gc() getchar_unlocked()
      |              ^~~~~~~~~~~~~~~~
main.c:14:17: note: in expansion of macro 'gc'
   14 |         do *s = gc();
      |                 ^~

ソースコード

diff #

// yukicoder: No.653 E869120 and Lucky Numbers
// 2019.7.20 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

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

char p[20003], *s; int w;

int main()
{
	int ans = 0;
	w = ins(p), s = p+w;
	if (*--s < '2' || *s > '4') goto done;
	while (--w) { if (*--s < '3' || *s > '5') break; }

	if (w == 1 && *s == '1') ans = 1;
	else if (w) {
		if (*s < '7' || *s > '8') goto done;
		w--, s--; while (w) { w--; if (*--s < '6' || *s > '7') break; }
		if (w == 0) ans = 1;
	}
done: puts(ans? "Yes": "No");
	return 0;
}
0