Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
34993 | A21μΘ_wjy | 【S】T1 | C++ | 通过 | 100 | 0 MS | 256 KB | 707 | 2024-11-21 13:30:49 |
#include<bits/stdc++.h> #define int long long using namespace std; const int mod=1e9+7; inline int qpow(int a,int b){ int ans=1; while(b){ if(b&1)ans=ans*a%mod; a=a*a%mod; b>>=1; } return ans; } inline int ALL(int l,int r){return (qpow(2,r+1)-qpow(2,l)+mod)%mod;} inline int re(int r){ int t=((r+1)/2)*3%mod; if(r%2==0)(t+=1)%=mod; return t; } inline int rem(int l,int r){return (re(r)-re(l-1)+mod)%mod;} signed main(){ // freopen("bala.in","r",stdin); // freopen("bala.out","w",stdout); int l,r; cin>>l>>r; int t=(ALL(l,r)-rem(l,r)+mod)%mod; (t*=qpow(3,mod-2))%=mod; cout<<t<<endl; return 0; }