結果

問題 No.836 じょうよ
ユーザー bal4ubal4u
提出日時 2019-06-16 05:17:35
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 4 ms / 1,000 ms
コード長 1,061 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 29,644 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-14 05:14:37
合計ジャッジ時間 2,271 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,376 KB
testcase_01 AC 0 ms
4,376 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 0 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 0 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 AC 4 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 AC 0 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 0 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 0 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 0 ms
4,376 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 0 ms
4,380 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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