結果
| 問題 |
No.544 Delete 7
|
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-04-20 16:36:27 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 672 bytes |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 28,672 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-01 13:15:48 |
| 合計ジャッジ時間 | 2,276 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 48 |
コンパイルメッセージ
main.c: In function 'ins':
main.c:7:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
7 | #define gc() getchar_unlocked()
| ^~~~~~~~~~~~~~~~
main.c:16:17: note: in expansion of macro 'gc'
16 | do *s = gc();
| ^~
main.c: In function 'outs':
main.c:8:15: warning: implicit declaration of function 'putchar_unlocked' [-Wimplicit-function-declaration]
8 | #define pc(c) putchar_unlocked(c)
| ^~~~~~~~~~~~~~~~
main.c:22:33: note: in expansion of macro 'pc'
22 | void outs(char *s) { while (*s) pc(*s++); }
| ^~
ソースコード
// yukicoder: No.544 Delete 7
// 2019.4.20 bal4u
#include <stdio.h>
#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int ins(char *s) // 文字列の入力 スペース以下の文字で入力終了
{
char *p = s;
do *s = gc();
while (*s++ > ' ');
*--s = 0;
return s - p;
}
void outs(char *s) { while (*s) pc(*s++); }
char A[12];
char B[12] = "00000000000";
int main()
{
int i, w;
w = ins(A), B[w] = 0;
for (i = 0; i < w; i++) {
if (A[i] == '7') A[i] = '8', B[i] = '1';
}
outs(A), pc(' '), pc('-');
i = 0; while (B[i] == '0') i++;
outs(B+i), pc('\n');
return 0;
}
bal4u