問題
B – 高橋くんの集計
回答
切り上げ
import math N = int(input()) A = list(map(int, input().split())) cnt_bugs = 0 cnt_softwares = 0 for a in A: cnt_bugs += a if a > 0: cnt_softwares += 1 avg_bugs = cnt_bugs / cnt_softwares print(math.ceil(avg_bugs))
Freedom is a responsible choice.
import math N = int(input()) A = list(map(int, input().split())) cnt_bugs = 0 cnt_softwares = 0 for a in A: cnt_bugs += a if a > 0: cnt_softwares += 1 avg_bugs = cnt_bugs / cnt_softwares print(math.ceil(avg_bugs))