結果

問題 No.549 素材合成システム
ユーザー bal4u
提出日時 2019-07-09 21:29:41
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 476 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 29,696 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 17:14:36
合計ジャッジ時間 1,674 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'in':
main.c:7:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
    7 | #define gc() getchar_unlocked()
      |              ^~~~~~~~~~~~~~~~
main.c:13:24: note: in expansion of macro 'gc'
   13 |         int n = 0, c = gc();
      |                        ^~

ソースコード

diff #

// yukicoder: No.549 素材合成システム
// 2019.7.9 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

int main()
{
	int ma, x, N, ans;
	
	ans = ma = 0, N = in();
	while (N--) {
		x = in();
		if (x > ma) ma = x;
		ans += x >> 1;
	}
	ans += ma - (ma >> 1);
	printf("%d\n", ans);
	return 0;
}
0