結果

問題 No.653 E869120 and Lucky Numbers
ユーザー bal4u
提出日時 2019-07-20 16:26:34
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 731 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-13 18:20:31
合計ジャッジ時間 1,070 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
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) {
			if (*s < '6' || *s > '7') break;
			w--, s--;
		}
		if (w == 0) ans = 1;
	}
done: puts(ans? "Yes": "No");
	return 0;
}
0