Skip to content
sjoonb edited this page Feb 3, 2022 · 11 revisions

timeout

try to use..

ios::sync_with_stdio(false)
cin.tie(nullptr
cout << ret << "\n"

dp

If wrong but logic is right, then check ..

reference type

int ret = dp[][] => int &ret = dp[][]

overflow

tip: convert int type to long long type

misreading

especially in the range

If tricky,

try start index with 1

think about initial state and final state more carefully

math

number conversion

N to 10

ex) N = 7

352.6(7) = 3*7^2 + 5*7^1 + 2*7^0 + 6*7^-1
= 147 + 35 + 2 + 6/7 = 184.857(10)

10 to N

ex) N = 2

37/2 --- 몫 : 18, 나머지 : 1
18/2 --- 몫 : 9, 나머지 : 0
9/2 --- 몫 : 4, 나머지 : 1
4/2 --- 몫 : 2, 나머지 : 0
2/2 --- 몫 : 1, 나머지 : 0
1/2 --- 몫 : 0, 나머지 : 1    (나머지의 역순을 나열)

2 to 2^n

Break it into (n) bits and convert it, and then concatenate.

ex) n = 3

111101(2) => 111(2), 101(2) => 7, 5 => 75(8)

2^n to 2

Convert each bit into (n) bits, and then concatenate.

ex) n = 4

AF(16) => A(16), F(16) => 1010(2), 1111(2) => 10101111(2)

except

Can't convert directly. Have to pass through the decimal number.

ex) 2 -> 10 -> 7.

reference