結果

問題 No.552 十分簡単な星1の問題
ユーザー bal4u
提出日時 2019-04-18 17:55:13
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 490 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 28,544 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-22 09:21:16
合計ジャッジ時間 1,324 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 47
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'ins':
main.c:8:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
    8 | #define gc() getchar_unlocked()
      |              ^~~~~~~~~~~~~~~~
main.c:17:17: note: in expansion of macro 'gc'
   17 |         do *s = 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:23:33: note: in expansion of macro 'pc'
   23 | void outs(char *s) { while (*s) pc(*s++); }
      |                                 ^~

ソースコード

diff #

// yukicoder: No.552 十分簡単な星1の問題
// 2019.4.18 bal4u

#include <stdio.h>
#include <ctype.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 s[25];

int main()
{
	int w = ins(s);
	if (s[0] != '0') s[w] = '0';
	outs(s), pc('\n');
	return 0;
}
0