재귀

https://www.acmicpc.net/problem/9527 9527번: 1의 개수 세기 두 자연수 A, B가 주어졌을 때, A ≤ x ≤ B를 만족하는 모든 x에 대해 x를 이진수로 표현했을 때 1의 개수의 합을 구하는 프로그램을 작성하시오. 즉, f(x) = x를 이진수로 표현 했을 때 1의 개수라 www.acmicpc.net #include using namespace std; #define fastio cin.tie(0)->sync_with_stdio(0) using ll = long long; using pii = pair; using pll = pair; map mp; void init() { mp[1] = 1; for(int i = 2; pow(2, i) - 1 > a >> b; ini..
munhwas1140
'재귀' 태그의 글 목록