Problem - 1796C - Codeforces
题意:
思路:
模拟一下样例可以发现一些规律
Code:
#include <bits/stdc++.h>
#define int long long
using i64 = long long;
constexpr int N = 1e6 + 10;
constexpr int mod = 998244353;
void solve() {
int l, r;
std::cin >> l >> r;
int k = log2((1.0 * r) / l);
int l1 = r / (1ll << k);
int l2 = r / 3 / (1ll << (k - 1));
std::cout << k + 1 << " " << ((l2 - l + 1) * k * (l2 >= l) % mod+ (l1 - l + 1)) % mod << "\n";
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t = 1;
std::cin >> t;
while(t --) {
solve();
}
return 0;
}