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] クラスメソッドと静的メソッド

今まで、Python でのクラスメソッド、静的メソッドを意識したことがなかったので、備忘録です。 Difference between staticmethod and classmethod 静的メソッドはクラスの外に定義されている関数と同じ。確たる理由がなければ...

記事を読む

[Python] ABC019 B

問題 B - 高橋くんと文字列圧縮 回答 s = input() s_compressed = '' cnt = 1 for i, ch in enumerate(s): if i == 0: ch_pre = ch ...

記事を読む

[Python] リストのコピー

問題 a = b = list(a) a =10 print(b) 答え 11 が出力されます。 Pythonでは、リストは代入すると同じリストを指します。 >>> a = >>> b = a >>> a is b True >>> id(a)...

記事を読む

[Python] Educational DP Contest H – Grid 1

問題 H - Grid 1 DP、数え上げ問題。 回答 import sys # input処理を高速化する input = sys.stdin.readline def main(): # input H, W = map(int,...

記事を読む

[Python] Seleniumを使ってみる (1)

Selenium Seleniumは、webアプリケーションのテストのためのフレームワークですが、スクレイピングでも良く使われます。Seleniumを使うことで、webブラウザを操作することができます。 公式サイト 今回はPythonでSeleniumを使うこ...

記事を読む


Public Domain YottaGin No Rights Reserved.