結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー bal4ubal4u
提出日時 2019-04-20 22:37:33
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 824 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 31,232 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 06:22:57
合計ジャッジ時間 916 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 0 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'ins':
main.c:8:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
    8 | #define gc() getchar_unlocked()
      |              ^~~~~~~~~~~~~~~~
main.c:18:17: note: in expansion of macro 'gc'
   18 |         do *s = gc();
      |                 ^~
main.c: In function 'outs':
main.c:9:15: warning: implicit declaration of function 'putchar_unlocked' [-Wimplicit-function-declaration]
    9 | #define pc(c) putchar_unlocked(c)
      |               ^~~~~~~~~~~~~~~~
main.c:24:33: note: in expansion of macro 'pc'
   24 | void outs(char *s) { while (*s) pc(*s++); }
      |                                 ^~

ソースコード

diff #

// yukicoder: No.446 ゆきこーだーの雨と雪 (1)
// 2019.4.20 bal4u

#include <stdio.h>
#include <ctype.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

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

void outs(char *s) { while (*s) pc(*s++); }

int main()
{
	int i, j, w, k;
	char s[20];

	for (j = 0; j < 2; j++) {
		w = ins(s);
		if (w == 1) {
			if (!isdigit(s[0])) goto NG;
		} else {
			k = 0; for (i = 0; i < w; i++) {
				if (!isdigit(s[i]) || (i != w-1) && s[i] == '0') goto NG;
				k = 10*k + (s[i]&0xf);
			}
			if (k > 12345) goto NG;
		}
	}
	outs("OK\n");
	return 0;
NG: outs("NG\n");
	return 0;
}
0