結果

問題 No.653 E869120 and Lucky Numbers
ユーザー bal4u
提出日時 2019-07-20 18:04:51
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 28,800 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 18:20:16
合計ジャッジ時間 1,169 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 main()
{
	int ans = 0;
	s = p + ins(p+1);
	if (*s >= '2' && *s <= '4') {
		while (*--s >= '3' && *s <= '5');
		if (*s == '1' && *(s-1) == 0) ans = 1;
		else if (*s == '7' || *s == '8') {
			while (*--s == '6' || *s == '7');
			if (*s == 0) ans = 1;
		}
	}
	puts(ans? "Yes": "No");
	return 0;
}
0