QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#136849#241. Chiaki Sequence Revisitednameless_story#Compile Error//C++201.5kb2023-08-09 12:54:142023-08-09 12:54:17

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-09 12:54:17]
  • 评测
  • [2023-08-09 12:54:14]
  • 提交

answer

#include<bits\stdc++.h>

using namespace std;

typedef long long LL;
typedef long long ll;

int a[10000],b[10000],c[10000];
const int kcz=1000000007;
const int inv2=kcz+1>>1;
int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    // int n; cin>>n;
    // a[1]=a[2]=1;
    // for (int i=3;i<=n;++i){
    //     a[i]=a[i-a[i-1]]+a[i-1-a[i-2]];
    // }
    // for (int i=1;i<=n;++i){
    //     b[i]=a[i]-a[i-1];
    // }
    // ll sum=0;
    // for (int i=1;i<=n;++i){
    //     c[i]=b[i]-b[i-1];
    //     sum+=a[i];
    //     cout<<i<<' '<<sum<<' '<<a[i]<<' '<<b[i]<<' '<<c[i]<<'\n';
    // }
    int T;
    cin>>T;
    while(T--)
    {
        ll n;
        cin>>n;
        ll l=1,r=n;
        auto fun=[&](ll n)
        {
            ll ret=0;
            while(n)
            {
                ret+=n;
                n/=2;
            }
            return ret+1;
        };
        auto fum=[&](ll n)
        {
            ll ret=0,t=n,base=1;
            while(n)
            {
                ret+=n%kcz*((n+1)%kcz)%kcz*inv2%kcz*base%kcz;
                n/=2;
                base=base*2ll%kcz;
            }
            return (ret+1)%kcz;
        };
        // cerr<<fum(1000)<<'\n';
        // exit(0);
        while(l<r)
        {
            ll mid=l+r>>1;
            if(fun(mid)<=n)
            l=mid+1;
            else
            r=mid;
        }
        r--;
        cout<<(fum(r)+(n-fun(r))%kcz*((r+1)%kcz)%kcz)%kcz<<'\n';
    }
}

Details

answer.code:1:9: fatal error: bits\stdc++.h: No such file or directory
    1 | #include<bits\stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.