結果

問題 No.3216 Slightly Strong Fairies
ユーザー elphe
提出日時 2025-08-01 21:44:00
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 787 bytes
コンパイル時間 833 ms
コンパイル使用メモリ 85,252 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-08-01 21:44:02
合計ジャッジ時間 2,098 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>
#include <vector>

static inline constexpr uint_fast32_t prepare(const uint_fast32_t N, const std::vector<uint_fast32_t>& A) noexcept
{
	uint_fast32_t ans = 0;
	for (uint_fast32_t i = 0; i != N; ++i)
		ans += A[i];

	return ans / N;
}

static inline constexpr uint_fast32_t solve(const uint_fast32_t N, const std::vector<uint_fast32_t>& A) noexcept
{
	const uint_fast32_t ave = prepare(N, A);
	uint_fast32_t ans = 0;
	for (uint_fast32_t i = 0; i != N; ++i)
		if (A[i] >= ave + 100)
			++ans;

	return ans;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	
	uint_fast32_t N, i;
	std::cin >> N;
	std::vector<uint_fast32_t> A(N);
	for (i = 0; i != N; ++i)
		std::cin >> A[i];

	std::cout << solve(N, A) << '\n';
	return 0;
}
0