ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#214625 | #2477. 狸猫的数 | shiruiheng | 50 | 148ms | 79320kb | C++11 | 1.0kb | 2024-11-20 20:56:00 | 2024-11-20 23:07:10 |
answer
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
__gnu_pbds::tree<std::pair<int, int>, __gnu_pbds::null_type,
std::less<std::pair<int, int>>, __gnu_pbds::rb_tree_tag,
__gnu_pbds::tree_order_statistics_node_update>
trr;
using namespace __gnu_cxx;
//*/
#define ll long long
#define pi pair<ll, ll>
#define fi first
#define se second
#define mod 998244353ll
//#define inv2 (mod - mod / 2)
#define inv2 499122177
#define N 11111111
ll cnt[N], sum, ans;
int main()
{
ll l, r;
cin >> l >> r;
for(int i = 1 ; i <= r ; i++){
if(i == 1){
cnt[i] = 2;
}
else if(i % 2 == 0)
cnt[i] = cnt[i / 2];
else
cnt[i] = ((cnt[i / 2] + cnt[i / 2 + 1]) * inv2 % mod + 1) % mod;
sum = (cnt[i] + sum) % mod;
if(i == l - 1)
ans = sum;
//cerr << cnt[i] << " ";
}
cout << (sum - ans + mod) % mod;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
2 20
output:
249561151
result:
ok single line: '249561151'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
2 99
output:
62390703
result:
ok single line: '62390703'
Test #3:
score: 10
Accepted
time: 38ms
memory: 79320kb
input:
2 10000000
output:
761228612
result:
ok single line: '761228612'
Test #4:
score: 10
Accepted
time: 62ms
memory: 79316kb
input:
6224 9999999
output:
364267526
result:
ok single line: '364267526'
Test #5:
score: 10
Accepted
time: 48ms
memory: 65600kb
input:
233 8244453
output:
766249426
result:
ok single line: '766249426'
Test #6:
score: 0
Runtime Error
input:
19260817 19260917
output:
result:
Test #7:
score: 0
Runtime Error
input:
19260817 998244353
output:
result:
Test #8:
score: 0
Runtime Error
input:
233 999244353
output:
result:
Test #9:
score: 0
Runtime Error
input:
233 1000000007
output:
result:
Test #10:
score: 0
Runtime Error
input:
1 2000000007