結果
| 問題 |
No.836 じょうよ
|
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-06-16 05:11:49 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,059 bytes |
| コンパイル時間 | 374 ms |
| コンパイル使用メモリ | 30,720 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-21 23:13:08 |
| 合計ジャッジ時間 | 2,283 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 WA * 20 |
コンパイルメッセージ
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++); }
| ^~
ソースコード
// 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;
}
bal4u