baekjoon 20260115
This commit is contained in:
parent
8d396cd114
commit
06b9cd2782
32
code_study/Baekjoon/c/9527.c
Normal file
32
code_study/Baekjoon/c/9527.c
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
typedef long long ll;
|
||||||
|
|
||||||
|
ll dp[55];
|
||||||
|
|
||||||
|
ll count_one(ll N);
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
ll A, B;
|
||||||
|
scanf("%lld %lld",&A, &B);
|
||||||
|
|
||||||
|
for(int i=1; i<55; i++) dp[i] = 2*dp[i-1] + (1LL << (i-1));
|
||||||
|
|
||||||
|
printf("%lld\n", count_one(B) - count_one(A-1));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ll count_one(ll N) {
|
||||||
|
ll res = 0;
|
||||||
|
for(int i=54; i>0; i--) {
|
||||||
|
ll MSB = N & (1LL <<(i-1));
|
||||||
|
|
||||||
|
if(MSB) {
|
||||||
|
res += dp[i-1] + (N - MSB + 1);
|
||||||
|
N -= MSB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
3
code_study/Baekjoon/ts/14581.ts
Normal file
3
code_study/Baekjoon/ts/14581.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export {};
|
||||||
|
const s = require("fs").readFileSync(0).toString().trim();
|
||||||
|
console.log(":fan::fan::fan:\n" + ":fan::" + s + "::fan:" + "\n:fan::fan::fan:\n");
|
||||||
Loading…
x
Reference in New Issue
Block a user