0
0

More than 3 years have passed since last update.

AtCoder備忘録(Python3)

Last updated at Posted at 2020-05-05

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

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0