YottaGin

Freedom is a responsible choice.

[Python] ABC015 B

2019/12/10 2019/12/10 プログラミング

問題

B – 高橋くんの集計

回答

切り上げ

math.ceil(x)

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))

Atcoder, Python GinO

関連記事

[Python] ABC015 A

問題 A - 高橋くんの研修 回答 A = input() B = input() if len(A) > len (B): print(A) else: print(B)

記事を読む

[Python] 数値と数字の変換

数字→数値 組み込み関数intを使います。 組み込み関数intを使わないで書いてみます。 def str_to_int(str_num): # 正と負で変換の開始位置が異なる。 if str_num == '-': s...

記事を読む

[Python] ABC016 A

問題 A - 12月6日 回答 M, D = map(int, input().split()) remainder = M % D if remainder == 0: print('YES') else: print('NO')

記事を読む

[Python] multiprocessingを試す (3)

前回からの続きです。 multiprocessing の log 記録の方法です。 ログ記録 multiprocessing.get_logger() と multiprocessing.log_to_stderr() を使うことで、プロセスごとの...

記事を読む

[Python] ABC004 A

A - 流行 n = int(input()) print(n*2) さすがに簡単。

記事を読む


Public Domain YottaGin No Rights Reserved.