AtCoder Beginners Selectionに取り組んだ時の備忘録
↓各桁の和を求める
参考:https://www.suzu6.net/posts/30/
def digitSum(n):
# 数値を文字列に変換
s = str(n)
# 1文字ずつ数値化し配列にする。
array = list(map(int, s))
# 合計値を返す
return sum(array)
↓スペース区切りで複数回入力しリスト(l)に格納する
l = list(map(int, input().split()))
↓スペース区切りで複数回整数を入力し各変数に格納する
n, a, b=(int(x) for x in input().split())
↓リスト(l)の各要素を2で割る
l = list(map(lambda x: x / 2, l))
↓リスト(l)を降順に並び替える
l_sorted = sorted(l, reverse=True)