0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

2 行目で与えられる N 個の整数の入力 (large)

Posted at

次はこれ(途中何題か簡単だったので飛ばしてます)
https://paiza.jp/works/mondai/stdin_primer/stdin_primer__integer_number_step4

これも一応簡単な部類に入るんだけど、
内容としてはこんな感じ。

N = int(input())
arr = input().split()

for i in arr:
    print(int(i))

で、ここでmap()というものを使えるようにしようということで
前半をmap()とlist()を使って書いてみます

# map()を使わない書き方
arr = input().split()
for i in arr:
    print(int(i))

# map()を使う書き方(※split()はsplit(" ")でもOK)
arr = list(map(int, input().split()))

#一応、下でもOK(list()がない)だった
arr = map(int,input().split())

#こうすると次のループがeasyに
for i in arr:
    print(i)

まだまだ書き慣れてないですが
とりあえず以上で

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?