zoukankan      html  css  js  c++  java
  • contest 12.31

    A.新年礼物

    #include <iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<ctype.h>
    #include<algorithm>
    #define inf 0x3f3f3f3f
    #define mod 1000000007
    typedef long long ll;
    using namespace std;
     
    int main()
    {
        ll l,r;scanf("%lld%lld",&l,&r);
        ll ans=r/l;
        ans=ll(log(ans*1.0)*1.0/log(2.0));
        printf("%lld
    ",ans+1);
        return 0;
    }
    View Code

    G.瓦卡吃瓜瓜

    #include <iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<ctype.h>
    #include<algorithm>
    #define inf 0x3f3f3f3f
    #define mod 1000000007
    typedef long long ll;
    using namespace std;
     
    int main()
    {
        int T;scanf("%d",&T);
        while(T--){
            int a,b;scanf("%d%d",&a,&b);
            int x=(a+1)/2;
            int y=b/2;
            //printf("x=%d y=%d
    ",x,y);
            if(x>y) puts("AWaDa!");
            else puts("AKTang!");
        }
        return 0;
    }
     
    View Code

    B.新年网页

    模拟

    #include <iostream>
    #include<cstdio>
    #include<cstring>
    using namespace std;
     
    int in[2019];
    char s1[20],s2[20];
     
    int main()
    {
        int n,k,T,m;
        scanf("%d%d%d%d",&n,&k,&T,&m);
        int flag=0,now=T;
        in[0]=in[n+1]=1;
        for(int i=max(1,now-k);i<=min(n,now+k);i++){
            if(i==1) in[i]=1,in[i-1]=0;
            else if(i==n) in[i]=1,in[i+1]=0;
            else in[i]=1;
        }
        for(int i=0;i<=n+1;i++){
            if(!in[i]) continue;
            else{
                if(flag) printf(" ");
                flag=1;
                if(i==0) printf("<<");
                else if(i==n+1) printf(">>");
                else if(i==now) printf("(%d)",i);
                else printf("%d",i);
            }
        }
        puts("");
        while(m--){
            scanf("%s%s",s1,s2);
            if(s2[0]=='<') now=0;
            else if(s2[0]=='>') now=n+1;
            else now=s2[0]-'0';
            if(!in[now]){
                printf("WARNING
    ");
                continue;
            }
            else{
                now=min(now,n);now=max(now,1);
                memset(in,0,sizeof(in));
                in[0]=in[n+1]=1;
                for(int i=max(1,now-k);i<=min(n,now+k);i++){
                   if(i==1) in[i]=1,in[i-1]=0;
                   else if(i==n) in[i]=1,in[i+1]=0;
                   else in[i]=1;
                }
                int flag=0;
                for(int i=0;i<=n+1;i++){
                    if(!in[i]) continue;
                    else{
                        if(flag) printf(" ");
                        flag=1;
                        if(i==0) printf("<<");
                        else if(i==n+1) printf(">>");
                        else if(i==now) printf("(%d)",i);
                        else printf("%d",i);
                    }
                }
                puts("");
            }
        }
        return 0;
    }
    View Code

    J.烤乐滋排队

    dp+分解因子

    #include <iostream>
    #include<cstdio>
    #include<cmath>
    #include<algorithm>
    #define mod 998244353
    typedef long long ll;
    using namespace std;
     
    ll a[100005];
    ll dp[100005];
     
    void f(ll x){
      for(ll i=2;i*i<x;i++){
        if(x%i==0){
          dp[i]=(dp[i]+dp[x])%mod;
          dp[x/i]=(dp[x/i]+dp[x])%mod;
        }
      }
      if(x!=1){
        dp[1]=(dp[1]+dp[x])%mod;
        ll tmp=sqrt(x);
        if(tmp*tmp==x) dp[tmp]=(dp[tmp]+dp[x])%mod;
      }
    }
     
    int main()
    {
        ll n;scanf("%lld",&n);
        for(ll i=1;i<=n;i++){
            scanf("%lld",&a[i]);
            dp[a[i]]=1;
        }
        sort(a+1,a+1+n);
        for(ll i=n;i>=1;i--){
            f(a[i]);
        }
        ll ans=0;
        for(ll i=1;i<=n;i++){
            //printf("%d %d
    ",a[i],dp[a[i]]);
            ans=(ans+dp[a[i]])%mod;
        }
        ans=(ans+1)%mod;
        printf("%lld
    ",ans);
        return 0;
    }
    View Code

    F.阿卡分糖果

    D.烤乐滋下棋

    转载请注明出处:https://www.cnblogs.com/lllxq/
  • 相关阅读:
    记录Integer比较问题
    代码中获取git输出
    python open mode
    elasticsearch Unrecognized VM option 'UseParNewGC'
    应用商店显示无法加载页面 请稍后重试
    deep learning with python前五章笔记
    QWeb2: Template 'systray_odoo_referral.gift_icon' not found
    wifi scapy
    struct.pack, struct.unpack详解
    python f-string
  • 原文地址:https://www.cnblogs.com/lllxq/p/10204758.html
Copyright © 2011-2022 走看看