0
0

チート:paiza Python3

Last updated at Posted at 2022-12-26

〇 目次
#1 標準入力(空白区切りの文字列(1行)を配列に)
#2 標準入力(空白区切りの文字列(複数行)を配列に)
#3 標準入力(連続文字(1行)を1文字ずつ分割して配列に)
#4 標準入力(連続文字(複数行)を1文字ずつ分割して配列に)
======================================
#1 標準入力(空白区切りの文字列(1行)を配列に)

1 2 3   # 入力値(空白区切りの文字列)

H = 1 ; W = 2 ; N = 3

H, W, N = map(int, input().split())

======================================
#2 標準入力(空白区切りの文字列(複数行)を配列に)

1 2 3   # 入力値(空白区切りの文字列、1行目)
4 5 6   # 入力値(2行目)

P = [[1,2,3],[4,5,6]]

H = 2   # 行数をHとして
P = [list(map(int,input().split())) for _ in range(H)];

======================================
#3 標準入力(連続文字(1行)を1文字ずつ分割して配列に)

ABCD   # 入力値(連続文字)

S = ["A","B","C","D"]

S = list(input())

======================================
#4 標準入力(連続文字(複数行)を1文字ずつ分割して配列に)

ABCD   # 入力値(1行目)
EFGH   # 入力値(2行目)

S = [["A","B","C","D"],["E","F","G","H"]]

H = 2   # 行数をHとして
S = [list(input()) for _ in range(H)]

======================================
以上

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