結果

問題 No.836 じょうよ
ユーザー bal4ubal4u
提出日時 2019-06-16 05:15:38
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,085 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 30,848 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-01 17:50:57
合計ジャッジ時間 1,694 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
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 function 'in':
main.c:8:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
    8 | #define gc() getchar_unlocked()
      |              ^~~~~~~~~~~~~~~~
main.c:16:34: note: in expansion of macro 'gc'
   16 |         long long n = 0; int 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:36:33: note: 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;
	printf("b=%lld\n", b);
	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