25 lines
452 B
C++
25 lines
452 B
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
int F(int x) {
|
|
if (x == 0) return 0;
|
|
return F(x / 10) * 2 + x % 10;
|
|
}
|
|
int fa;
|
|
int main() {
|
|
int T;
|
|
int num = 1;
|
|
cin >> T;
|
|
|
|
while (T--) {
|
|
int x, y;
|
|
cin >> x >> y;
|
|
fa = F(x);
|
|
int cnt = 0;
|
|
for (int i = 0; i <= y; i++)
|
|
if (F(i) <= fa) cnt++;
|
|
|
|
printf("Case #%d: %d\n", num++, cnt);
|
|
}
|
|
return 0;
|
|
} |