-
Notifications
You must be signed in to change notification settings - Fork 0
Home
sjoonb edited this page Feb 3, 2022
·
11 revisions
ios::sync_with_stdio(false)
cin.tie(nullptr
cout << ret << "\n"
int ret = dp[][] => int &ret = dp[][]
tip: convert int type to long long type
especially in the range
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)
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 (나머지의 역순을 나열)
Break it into (n) bits and convert it, and then concatenate.
ex) n = 3
111101(2) => 111(2), 101(2) => 7, 5 => 75(8)
Convert each bit into (n) bits, and then concatenate.
ex) n = 4
AF(16) => A(16), F(16) => 1010(2), 1111(2) => 10101111(2)
Can't convert directly. Have to pass through the decimal number.
ex) 2 -> 10 -> 7.