ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#214645 | #2477. 狸猫的数 | Super_Leo66 | 50 | 118ms | 157440kb | C++11 | 453b | 2024-11-20 22:09:47 | 2024-11-20 23:10:12 |
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MOD=998244353,INV=(MOD+1)>>1,N=1e7+5;
int a[N],pre[N];
signed main(){
int l,r;
cin>>l>>r;
a[1]=pre[1]=2;
for(int i=1;i<=r;i++){
if(i&1^1){
a[i]=a[i>>1];
pre[i]=pre[i-1]+a[i];
continue;
}
a[i+1]=a[(i+1)>>1];
a[i]=((a[i-1]+a[i+1])%MOD*INV%MOD+1)%MOD;
pre[i]=pre[i-1]+a[i];
}
cout<<((pre[r]-pre[l-1])%MOD+MOD)%MOD<<endl;
return 0;
}
Details
小提示:点击横条可展开更详细的信息
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: 36ms
memory: 157440kb
input:
2 10000000
output:
761228612
result:
ok single line: '761228612'
Test #4:
score: 10
Accepted
time: 51ms
memory: 157440kb
input:
6224 9999999
output:
364267526
result:
ok single line: '364267526'
Test #5:
score: 10
Accepted
time: 31ms
memory: 130016kb
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