0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AtCoderで必要な基礎知識(Python編)

Last updated at Posted at 2022-10-22

この記事ではAtCoderで必要な基礎知識をまとめてありますのでぜひ参考にしてください。

  • 標準入力
  • 標準出力

標準入力

一字の読み込み(数値)

n = int(input())

一行の読み込み(文字)

s = input().split()

一行の読み込み(数値)

nLine = [int(i) for i in input().split()]

一行目でサイズが指定された多重配列の読み込み(文字・空白あり)

nLine = [int(i) for i in input().split()]
sList = [input().split() for i in range(nLine[0])]

一行目でサイズが指定された多重配列の読み込み(文字・空白なし)

nLine = [int(i) for i in input().split()]
sList = [list(input()) for i in range(nLine[0])]

一行目でサイズが指定された多重配列の読み込み(数字・空白あり)

# 想定される入力形式
# N K
# A_1 ... A_K
# ... ... ...
# N_1 ... N_K
nLine = [int(i) for i in input().split()]
nList = [[0]*Line[1] for i in range(nLine[0])]
for i in range(nInt[0]):
    nList[i] = [int(i) for i in input().split()]

標準出力

桁数制限した数字の出力

#S:出力したい文字, .3f:小数点第三桁まで
print(format(S,'.3f'))
#右寄せ0埋め
n = 1
print(str(n).zfill(8))
#00000001

フラグ管理によるYes/No出力

flag = False
if(flag):
    print("Yes")
else: 
    print("No")
0
3
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
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?