YottaGin

Freedom is a responsible choice.

[Python] ABC014 A

2019/12/6 2019/12/6 プログラミング

問題

A – けんしょう先生のお菓子配り

回答

a = int(input())
b = int(input())

remainder = a % b

shortage = 0
if remainder > 0:
    shortage = b - remainder

print(shortage)

Atcoder, Python GinO

関連記事

[Python] ABC013 A

問題 A - A 回答  ord で Unicode コードポイント に変換して引き算します。 X = input() ans = ord(X) - ord('A') + 1 print(ans) 辞書で対応表を作成します。 X = inp...

記事を読む

[Python] コマンドプロンプトでtermcolorが文字化けする時

windows10のコマンドプロンプトでpythonのtermcolorで出力に色をつけようとすると、色ではなく文字化けが発生します。 termcolor は unix で使われる ANSIエスケープシーケンスというものを使うためで、これが windows のコマンドプ...

記事を読む

[Python] ABC017 A

問題 A - プロコン 回答 s1, e1 = map(int, input().split()) s2, e2 = map(int, input().split()) s3, e3 = map(int, input().split()) sum_sco...

記事を読む

[Python] ABC020 B

問題 B - 足し算 回答 A, B = input().split() AB = A + B ans = 2 * int(AB) print(ans)

記事を読む

[Python] lst = [].append

問題 何が表示されますか? lst = [].append(5) print(lst) 答え None が表示される。 何で?と最初分からなかった。 append()はリストをミューテイトした上でNoneを返す関数です。 lis...

記事を読む


Public Domain YottaGin No Rights Reserved.