結果

問題 No.836 じょうよ
ユーザー bal4ubal4u
提出日時 2019-06-16 05:11:49
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,059 bytes
コンパイル時間 1,064 ms
コンパイル使用メモリ 29,448 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-14 04:54:52
合計ジャッジ時間 4,281 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,376 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 0 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 0 ms
4,380 KB
testcase_09 AC 0 ms
4,380 KB
testcase_10 AC 0 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 0 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 AC 5 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘in’ 内:
main.c:8:14: 警告: 関数 ‘getchar_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    8 | #define gc() getchar_unlocked()
      |              ^~~~~~~~~~~~~~~~
main.c:16:34: 備考: in expansion of macro ‘gc’
   16 |         long long n = 0; int c = gc();
      |                                  ^~
main.c: 関数 ‘outs’ 内:
main.c:9:15: 警告: 関数 ‘putchar_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    9 | #define pc(c) putchar_unlocked(c)
      |               ^~~~~~~~~~~~~~~~
main.c:36:33: 備考: in expansion of macro ‘pc’
   36 | void outs(char *s) { while (*s) pc(*s++); }
      |                                 ^~

ソースコード

diff #

// yukicoder: 836 じょうよ
// 2019.6.15 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
long long in()    // 非負整数の入力
{
	long long n = 0; int c = gc();
	//	while (isspace(c)) c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

void out(char *s, long long n)  // 非負整数の表示(出力)
{
	int i;
	char b[50];

	if (!n) *s = '0';
	else {
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) *s++ = b[i];
	}
	*s++ = '\n';
	*s = 0;
}

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

char e[100005], f[100005];
char tbl[3][50];

int main()
{
	long long l, r, a, b;
	int i, n;
	
	l = in(), r = in(), n = (int)in();
	a = 0;
	if (l > 1) {
		a = --l / n;
		memset(e, 1, (int)(l%n));
	}
	b = r/n - a;
	memset(f, 1, (int)(r%n));
	out(tbl[0], b-1), out(tbl[1], b), out(tbl[2], b+1);
	n--, outs(tbl[1+f[n]-e[n]]);
	for (i = 0; i < n; i++) outs(tbl[1+f[i]-e[i]]);
	return 0;
}
0