-
백준 1086번 박성원 (못품)BOJ 문제 풀이 2020. 11. 17. 17:5112345678910111213141516171819202122232425262728293031from itertools import permutationsN = int(input())count = 0l = []for i in range(N):l.append(input())K = int(input())l = list(map(''.join, permutations(l)))for a in range(len(l)):if int(l[a]) % K == 0:count += 1print(count, len(l))if len(l) % count == 0:print("1" + "/" + str(len(l) // count))else:print(str(count) + "/" + str(len(l)))
cs 어렵다. 리스트에 전체 순열을 때려박아서 나눌려고 했는데 메모리 초과가 나와서 못 풀었다.
비트마스크인지 뭔지를 써야한다.
다음에 도전한다..
'BOJ 문제 풀이' 카테고리의 다른 글
백준 1251번 단어 나누기 (0) 2020.11.18 백준 1152번 단어의 개수 (0) 2020.11.17