結果

問題 No.501 穴と文字列
ユーザー bal4ubal4u
提出日時 2019-04-18 08:58:19
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 29,824 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 08:45:49
合計ジャッジ時間 986 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'in':
main.c:8:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
    8 | #define gc() getchar_unlocked()
      |              ^~~~~~~~~~~~~~~~
main.c:16:24: note: in expansion of macro 'gc'
   16 |         int n = 0, c = 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:21:39: note: in expansion of macro 'pc'
   21 | void outs(int w, int c) { while (w--) pc(c); }
      |                                       ^~

ソースコード

diff #

// yukicoder: No.501 穴と文字列
// 2019.4.18 bal4u

#include <stdio.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void outs(int w, int c) { while (w--) pc(c); }

int main()
{
	int N, D;
	N = in(), D = in();
	if (D > N) outs(2*N - D, 'A'), outs(D-N, 'B');
	else outs(D, 'A'), outs(N-D, 'C');
	pc('\n');
	return 0;
}
0