• camp训练day2


    https://vjudge.net/contest/313217

    喔要补完题!!

    A

    #include<bits/stdc++.h>
    using namespace std;
    const int mod=1e9+7;
    #define ll long long
    const int maxn=1e6+10;
    ll f[maxn][2];
    int main()
    {
        freopen("azerah.in","r",stdin);
        freopen("azerah.out","w",stdout);
        int t;
        scanf("%d",&t);
        while(t--)
        {
            int n;
            scanf("%d",&n);
            for(int i=1; i<=n; i++)
            {
                int a;
                scanf("%d",&a);
                f[i][0]=f[i][1]=0;
                if(a%2==0)
                {
                    f[i][0]=(f[i-1][0]*2)%mod;
                    f[i][1]=(f[i-1][1]*2)%mod;
                    f[i][0]=(f[i][0]+1)%mod;
                }
                else
                {
                    f[i][0]=(f[i-1][0]+f[i-1][1])%mod;
                    f[i][1]=(f[i-1][1]+f[i-1][0])%mod;
                    f[i][1]=(f[i][1]+1)%mod;
                }
    //            printf("%d %d
    ",f[i][0],f[i][1]);
            }
            printf("%lld
    ",f[n][0]%mod);
        }
        return 0;
    }
    View Code

    B

    C

    D

    E

    F

    G

    H

    I

    #include<bits/stdc++.h>
    using namespace std;
    //const int maxn=1e7+10;
    #define ll long long
    //map<ll,ll> m;
    
    ll fun(ll n)
    {
        ll ans=0;
        int i;
        for(i=1; i<=(int)sqrt(n); i++)
            ans=ans+n/i;
        i--;
        ans=ans*2;
        ans=ans-i*i;
        return ans;
    }
    int main()
    {
        freopen("perechi3.in","r",stdin);
        freopen("perechi3.out","w",stdout);
        int t;
        scanf("%d",&t);
        while(t--)
        {
            ll n;
            scanf("%lld",&n);
            ll ans=fun(n);
            printf("%lld
    ",ans);
        }
    
    }
    View Code

    J

    K

    L

    #include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    int main()
    {
        freopen("semipal.in","r",stdin);
        freopen("semipal.out","w",stdout);
        int t;
        scanf("%d",&t);
        while(t--)
        {
            int n;
            ll k;
            string s;
            scanf("%d%lld",&n,&k);
            k--;
            for(int i=n-1;i>=1;i--)
            {
                if((k>>(i-1))&1)
                    s+='b';
                else
                    s+='a';
            }
            s+=s[0];
            cout<<s<<endl;
        }
    }
    View Code
  • 相关阅读:
    uuid模块
    使用pip管理第三方包
    hashlib和hmac模块
    hashlib和hmac模块
    JAVA热部署,通过agent进行代码增量热替换!!!
    史上最全java pdf精品书籍整理
    JAVA RPC (十) nio服务端解析
    java代理,手把手交你写java代理
    JAVA RPC 生产级高可用RPC框架使用分享
    DB缓存一致性
  • 原文地址:https://www.cnblogs.com/dongdong25800/p/11232524.html
Copyright © 2020-2023  润新知