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] ハノイの塔

ハノイの塔 ハノイの塔(ハノイのとう、Tower of Hanoi)はパズルの一種。バラモンの塔またはルーカスタワー(Lucas' Tower)とも呼ばれる。 ハノイの塔出典: フリー百科事典『ウィキペディア(Wikipedia)』 再帰で良く出てくるア...

記事を読む

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

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

記事を読む

[Python] 双方向リスト

以下を参考にしています。 Data-Structures-using-Python/Linked Lists/DoublyLinkedList.py 双方向リスト 片方向リストは後方向へのリンクだけでしたが、双方向リスト(Doubly-Linked List)...

記事を読む

[Python] ABC016 D

問題 D - 一刀両断 回答 以下が大変参考になりました。 直線と線分 import numpy as np Ax, Ay, Bx, By = map(int, input().split()) N = int(input()) posit...

記事を読む

[Python] ABC003 D

D - AtCoder社の冬 import math # 順列 def P(n, r): return math.factorial(n)//math.factorial(n-r) # 組み合わせ def C(n, r): return P(n, r)/...

記事を読む


Public Domain YottaGin No Rights Reserved.