π
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input()) | |
k = int(input()) | |
arr = [int(input()) for _ in range(n)] | |
used = [False for _ in range(n)] | |
answer_set = set() | |
current_answer = [] | |
def fn(K): | |
if K == 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
n = int(input()) | |
k = int(input()) | |
arr = [int(input()) for _ in range(n)] | |
idx = [0 for _ in range(n)] | |
for i in range(n): | |
idx[i] = i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = 100 | |
checked = [-1 for _ in range(n)] | |
def fib(i): | |
if i <= 2: return 1 | |
global checked | |
if checked[i] != -1: | |
return checked[i] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = 100 | |
Sum = 0 | |
def fn(i): | |
global Sum | |
if i == n: return | |
for j in range(100): | |
Sum += 1 | |
fn(i + 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fib(n): | |
if n <= 2: return 1 | |
return fib(n - 1) + fib(n - 2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input()) | |
print("μ΄λ ν μ»΄ν¨ν°κ³΅νκ³Ό νμμ΄ μ λͺ ν κ΅μλμ μ°Ύμκ° λ¬Όμλ€.") | |
def fn(depth): | |
prefix = "_" * depth * 4 | |
print(prefix, end='"μ¬κ·ν¨μκ° λκ°μ?"\n') | |
if n == depth: | |
print(prefix, end='"μ¬κ·ν¨μλ μκΈ° μμ μ νΈμΆνλ ν¨μλΌλ€"\n') | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void solve() { | |
int n; | |
cin >> n; | |
cout << "μ΄λ ν μ»΄ν¨ν°κ³΅νκ³Ό νμμ΄ μ λͺ ν κ΅μλμ μ°Ύμκ° λ¬Όμλ€.\n"; | |
function<void(int)> fn = [&](int i) { | |
cout << string(i * 4, '_') << "\"μ¬κ·ν¨μκ° λκ°μ?\"\n"; | |
if (i == n) { | |
cout << string(i * 4, '_') << "\"μ¬κ·ν¨μλ μκΈ° μμ μ νΈμΆνλ ν¨μλΌλ€\"\n"; | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
sys.setrecursionlimit(10 ** 6) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Main { | |
public static void main(String[] args) { | |
Queue<Integer> q = new LinkedList<>(); | |
q.add(1); | |
int data = q.poll(); | |
System.out.println(data); // 1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
q = deque() | |
q.append(1) # O(1) backμ μ½μ | |
data = q.popleft() # O(1) frontμμ λ°μ΄ν° κ°μ Έμ€κ³ λΉΌκΈ° | |
print(data) # 1 |