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] multiprocessingを試す (3)

前回からの続きです。 multiprocessing の log 記録の方法です。 ログ記録 multiprocessing.get_logger() と multiprocessing.log_to_stderr() を使うことで、プロセスごとの...

記事を読む

[Python] Educational DP Contest D – Knapsack 1

問題 D - Knapsack 1D - Knapsack 1 回答 最初にTLEで間に合わなかった回答 考え方としては合っているはず…。 import sys # inputを高速化する。 input = sys.stdin.readline ...

記事を読む

[Python] k近傍法 (4) グリッドサーチ

前回からの続きです。 今回は、 k近傍法によるあやめの分類問題において、グリッドサーチを使うことでハイパーパラメータの探索を行います。 ハイパーパラメータの探索は、sklearn のサイトでは、以下にまとめられています。 3.2. Tuning t...

記事を読む

[Python] ABC003 B

B - AtCoderトランプ s = input() t = input() commercial_at = flag = True for i in range(len(s)): if s == t: continue elif ...

記事を読む

[Python] k近傍法での株価予測

ロジスティック回帰で、翌日の株価の上昇/下降を予測します。 k近傍法 k近傍法(ケイきんぼうほう、英: k-nearest neighbor algorithm, k-NN)は、特徴空間における最も近い訓練例に基づいた分類の手法であり、パターン認識でよく使われる...

記事を読む


Public Domain YottaGin No Rights Reserved.