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] ABC019 B

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

記事を読む

[Python] Educational DP Contest A – Frog 2

問題 B - Frog 2 回答 動的計画法を使って解く。 TLEで間に合わなかった回答 in, k = map(int, input().split()) h = # dpの最小値を変更する関数 def chmin(a, b): if...

記事を読む

[Python] 債券価格

現在割引価値を使った債券価格を Python で実装します。 債券 債券(さいけん、英:Bond)とは、社会的に一定の信用力のある発行体が資金を調達する際に、金銭消費貸借契約類似の法律関係に基づく金銭債権の内容を券面上に実体化させて発行する有価証...

記事を読む

[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)/...

記事を読む

[Python] ABC011 A

問題 A - 来月は何月? 回答 N = int(input()) # 12月以外 if N < 12: print(N+1) # 12月 else: print(1) 実際に Python で翌月や翌年といった計算を行う時は、d...

記事を読む


Public Domain YottaGin No Rights Reserved.