2016 ICPC 大连

Time:

Link


A

题意

分析


B

题意

分析


C

题意

分析


D

题意

 给出a和b,x+y=a,x*y/gcd(x,y)=b

分析

 结论:gcd(x,y)=gcd(a,b)


E

题意

分析


F

题意

 给出一个s,求出a1+a2+a3+a4+....an=s,中a数组的乘积最大值

分析

 czh:先列出前面几项的组成,可以发现规律,每个数将是接近2,3,4,5,6,7,8,9,我们利用前缀和,与前缀乘积,快速得到答案,比赛得适合一味的寻找规律,虽然知道组成,表也打出来了,但还是没做出来

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <queue>
using namespace std;
const int maxn=1e5+10;
const int mod=1e9+7;
#define ll long long
ll sum[maxn],mul[maxn];
ll qpow(ll a,ll b)
{
    ll k=a;
    ll res=1;
    while(b)
    {
        if(b&1)res=res*k%mod;
        k=k*k%mod;
        b/=2;
    }
    return res;
}
int main()
{
    int T,n;
    sum[1]=0;
    mul[1]=1;
    for(int i=2;i<=1e5;i++)
        sum[i]=sum[i-1]+i,mul[i]=mul[i-1]*i%mod;
    cin>>T;
    while(T--)
    {
        scanf("%d",&n);
        if(n==1)
        {
            printf("1
");
            continue;
        }
        int st=2,en=1e5;
        while(st!=en)
        {
            int mid=(st+en)/2;
            if(sum[mid]>=n)
                en=mid;
            else st=mid+1;
        }
        if(sum[st]-n==1)
        {
            printf("%lld
",mul[st+1]*qpow(st,mod-2)%mod*qpow(2,mod-2)%mod);
        }
        else if(sum[st]-n==0)
        {
            printf("%lld
",mul[st]);
        }
        else
        {
            printf("%lld
",mul[st]*qpow(sum[st]-n,mod-2)%mod);
        }

    }
    return 0;
}

  


G

题意

分析


H

题意

分析


I

题意

分析


J

题意

分析


K

题意

分析


Summary:

ym:

czh:无力感

hxx:  

原文地址:https://www.cnblogs.com/Deadline/p/9672192.html