#勉強
atcoderアルゴリズム
atcoderで解いた問題を共有します。
問題1解答コードdef sample1(): """A - Shift """a, b = map(int, input().split())A = list(map(int, input().split()))for i in range(b): n = A.pop(0) # 一番前のデータを取り出す A.append(0) # 一番
atcoderアルゴリズム②
atcoderで問題を解いたので共有したいと思います。
問題①解答コードN, K = map(int, input().split())p_list = list(map(int, input().split()))q_list = list(map(int, input().split()))confirm = 0flg = Falsefor i in p_list: for j in
ユークリッドの互除法
atcoder復習&勉強記録
問題①解答コードdef GCD(n_1, m_1): while n_1 >= 1 and m_1 >= 1: # 余りが0になるまで繰り返す。 if n_1 < m_1: # どっちが大きいのか確認 m_1 = m_1 % n_1 else: n_1 = n_1 % m_1 # mod(