zoukankan      html  css  js  c++  java
  • 哈理工多校算法赛三

    A 不凡的夫夫:https://www.nowcoder.com/acm/contest/75#question

    #include <bits/stdc++.h>
    #define PI 3.1415926535
    using namespace std;
    int main()
    {
        int t; scanf("%d",&t);
        while(t--)
        {
            double n,e=exp(1);
            scanf("%lf",&n);
            int ans=log(sqrt(2*n*PI))/log(8)+n*log(n/e)/log(8);
            if(n) printf("%d
    ",ans+1);
            else printf("1
    ");
        }
         
        return 0;
    }
    View Code

    斯特林公式 http://blog.csdn.net/zuzhiang/article/details/79256738

    B 一个小问题:https://www.nowcoder.com/acm/contest/75/B

    中国剩余定理 https://www.cnblogs.com/MashiroSky/p/5918158.html

    待解

    C 守护白起:https://www.nowcoder.com/acm/contest/75/C

    待解

    D 小牛VS小客:https://www.nowcoder.com/acm/contest/75/D

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        long long n;
        while(~scanf("%lld",&n))
        {
            if(n<=2) printf("XiaoNiu
    ");
            else printf("XiaoKe
    ");
        }
     
        return 0;
    }
    View Code

    博弈 待解

    E 进击把!阶乘:https://www.nowcoder.com/acm/contest/75/E

    #include <bits/stdc++.h>
    using namespace std;
    int a[10005];
    int main()
    {
        int n;
        while(~scanf("%d",&n))
        {
            int index=0;
            a[0]=1;
            for(int i=2;i<=n;i++)
            {
                int temp=0;
                for(int j=0;j<=index;j++)
                {
                    a[j]=a[j]*i+temp; /// 将前一位存入的temp加进来
                    temp=a[j]/10000; /// 如123456 将12存入temp
                    a[j]%=10000;  /// 3456 仍在原位
                }
                if(temp>0)
                    a[++index]=temp; /// 本轮乘后 超出原有的长度 新加一位
            }
            printf("%d",a[index]);
            for(int i=index-1;i>=0;i--)
            {
                if(a[i]>=1000) printf("%d",a[i]);
                else if(a[i]>=100) printf("0%d",a[i]);
                else if(a[i]>=10) printf("00%d",a[i]);
                else printf("000%d",a[i]);
            }
            printf("
    ");
        }
     
        return 0;
    }
    View Code

    F 小牛再战:https://www.nowcoder.com/acm/contest/75/F

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
        while(~scanf("%d",&n)&&n)
        {
            int cnt[105],maxa=0,i,num;
            memset(cnt,0,sizeof(cnt));
            for(i=0;i<n;i++)
            {
                scanf("%d",&num);
                cnt[num]++;
                maxa=max(num,maxa);
            }
            for(i=1;i<=maxa;i++)
                if(cnt[i]%2) break;
            if(i>maxa) printf("Lose
    ");
            else printf("Win
    ");
        }
     
        return 0;
    }
    View Code

    博弈 待解

    G 大水题:https://www.nowcoder.com/acm/contest/75/G

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        long long n;
        while(~scanf("%lld",&n))
        {
            long long uni;
            uni=(n/2)+(n/5)+(n/11)+(n/13)
            -(n/2/5)-(n/2/11)-(n/2/13)-(n/5/11)-(n/5/13)-(n/11/13)
            +(n/2/5/11)+(n/2/5/13)+(n/5/11/13)+(n/2/11/13)-(n/2/5/11/13);
            printf("%lld
    ",n-uni);
        }
     
        return 0;
    }
    View Code

    容斥定理

    H 向左走:https://www.nowcoder.com/acm/contest/75/H

    待解

    I 三角形:https://www.nowcoder.com/acm/contest/75/I

    题解 http://blog.csdn.net/zuzhiang/article/details/79256738

    向量和求面积https://www.cnblogs.com/xiexinxinlove/p/3708147.html

    皮克定理 待解

  • 相关阅读:
    CodeForces 576E Paingting Edges
    CodeForces 1361D Johnny and James
    agc027_d Modulo Matrix
    agc046_f Forbidden Tournament
    MySQL架构及优化原理
    Ubuntu下无法安装pip
    WSL安装问题----wslregisterdistribution failed with error: 0x8007007b
    基础排序算法总结(一)
    透明代理、匿名代理、混淆代理、高匿代理
    常见“加密”算法之 base64
  • 原文地址:https://www.cnblogs.com/zquzjx/p/8585193.html
Copyright © 2011-2022 走看看