LoginSignup
0
0

More than 3 years have passed since last update.

Atcoder Beginner Contest の A, B 問題でありがちな入力まとめ Python

Posted at

整数 $N$ を入力する
例:1

N = int(input())

整数の組 $A, B, C$ を入力する
例:1 4 3

A, B, C = map(int, input().split())

整数の組 $A_1, A_2, A_3, \cdots$ を入力する
例:1 4 3 2 5 2

# list型
A = list(map(int, input().split()))  # [1, 4, 3, 2, 5, 2]

# list型(昇順に並び替え)
A = sorted(map(int, input().split()))  # [1, 2, 2, 3, 4, 5]

# set型(重複を削除)
A = sorted(map(int, input().split()))  # {1, 2, 3, 4, 5}
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