목록알고리즘 문제풀이/AtCoder (2)
취미가 좋다
https://atcoder.jp/contests/abc215/tasks/abc215_d D - Coprime 2 AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp 주어진 범위 내에서, 주어진 수들과 모두 서로소(최대공약수가 1)가 되는 값를 찾는 문제이다. Solution N,M = map(int,input().split()) A = list(map(int,input().split())) maxA = max(max(A),M) k = [True] * (maxA+1) isprime = [True] * (maxA+1) prim..
https://atcoder.jp/contests/abc215/tasks/abc215_c C - One More aab aba baa AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp Solution from itertools import permutations s, k = input().split(' ') a = set([]) for i in permutations(s, len(s)): a.add(i) a = list(a) a.sort() k = int(k) - 1 print(''.join(a[k])) 문자열 s와 순서 ..