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

問題 B - choku語 回答 X = input() while X: if len(X)>=2 and X == 'ch': X = X elif X == 'o' or X == 'k' or X == 'u': ...

記事を読む

[Python] ABC020 A

問題 A - クイズ 回答 条件分岐 Q = int(input()) if Q == 1: print('ABC') else: print('chokudai') 三項演算子 Q = int(input()) a...

記事を読む

[Python] Educational DP Contest K – Stones

問題 K - Stones 参考 AtCoderDPまとめコンテスト K問題 「Stones」 例題 2. EDPC K 問題 - Stones 〜 石取りゲームの一般化 〜 回答 import sys # input処理を高速化する inp...

記事を読む

[Python] ABC012 C

問題 C - 九九足し算 回答 N = int(input()) SUM_MULTIPLY = 2025 diff = SUM_MULTIPLY - N ans_lst = [] for num in range(1, 10): if diff %...

記事を読む

[Python] ABC013 A

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

記事を読む


Public Domain YottaGin No Rights Reserved.