2017-2018 ACM-ICPC Asia East Continent League Final (ECL-Final 2017) 个人题解

题面:https://codeforces.com/gym/101775

  • A. Chat Group
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
const int maxn = 1e6+10;
const ll mod = 1000000007;

int T;
ll N,K;

ll ksm(ll a,ll b){
    ll res = 1;
    while(b){
        if(b&1) res = res*a%mod;
        a = a*a%mod;
        b>>=1;
    }
    return res;
}

ll solve(){
    ll pre = 1,ck = 1;
    for(ll k = 0;k<=K-2;k++){
        ck = ck*(N-k)%mod*ksm(k+1,mod-2)%mod;
        pre = (pre+ck)%mod;
    }
    return (ksm(2,N)-pre+mod)%mod;
}

int main(){
    cin>>T;
    int kase = 0;
    while(T--){
        cin>>N>>K;
        printf("Case #%d: %lld\n",++kase,solve());
    }
    return 0;
}
  • J. Straight Master
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
const int maxn = 1e6+10;

int T,N;
int a[maxn],b[maxn];//原数组,差分数组

bool judge(){
    ll sum = 0;
    for(int i = 1;i<=N+1;i++){
        if(b[i]>0) sum+=b[i];
        if(i+3<=N+1 && b[i+3]<0) sum += b[i+3];
        if(sum<0) return false;
    }
    return sum == 0;
}
int main(){
    cin>>T;
    int kase = 0;
    while(T--){
        memset(a,0,sizeof a);memset(b,0,sizeof b);
        cin>>N;
        for(int i = 1;i<=N;i++) scanf("%d",&a[i]);
        for(int i = 1;i<=N+1;i++) b[i] = a[i]-a[i-1];
        if(judge()) printf("Case #%d: Yes\n",++kase);
        else printf("Case #%d: No\n",++kase);
    }

    return 0;
}
  • L. SOS
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
const int maxn = 1e6+10;
const ll mod = 1000000007;

int T,N;

int main(){
    cin>>T;
    int kase = 0;
    while(T--){
        printf("Case #%d: ",++kase);
        cin>>N;
        if(N<7) puts("Draw");
        else if(N%2 == 1) puts("Panda");
        else if(N%2 == 0 && N>=16) puts("Sheep");
        else puts("Draw");
    }
    return 0;
}
  • M. World Cup
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
const int maxn = 1e6+10;
const ll mod = 1000000007;

int T,Q,x;
int money[10],p[100];

void init(){
    for(int i = 1;i<=48;i++) p[i] = money[1];
    for(int i = 49;i<=56;i++) p[i] = money[2];
    for(int i = 57;i<=60;i++) p[i] = money[3];
    for(int i = 61;i<=62;i++) p[i] = money[4];
    for(int i = 63;i<=63;i++) p[i] = money[5];
}

int main(){
    cin>>T;
    int kase = 0;
    while(T--){
        for(int i = 1;i<=5;i++) cin>>money[i];
        init();
        cin>>Q;
        ll y = 0;
        while(Q--){
            scanf("%d",&x);
            y += p[x];
        }
        printf("Case #%d: %lld\n",++kase,y*10000);
    }
    return 0;
}

原文地址:https://www.cnblogs.com/bigbrox/p/11622966.html

时间: 2024-11-01 14:48:01

2017-2018 ACM-ICPC Asia East Continent League Final (ECL-Final 2017) 个人题解的相关文章

The 2017 ACM-ICPC Asia East Continent League Final记录

首先感谢tyz学弟的麻麻-给我们弄到了名额- 然后就开始了ACM ECLFinal的玩耍,A*仙人掌可是立了flag要好好打的- 试机赛好像就全是GCJ kickstart的原题,然后AK了但是由于一上来乱交罚时大爆炸. 面到了qls,tls,llb,wdz,bike,kpm,lzt,qwd,zqc,dicint,yql好多好多好多人- 由于罚时爆炸了,于是晚上和ldz商量大概就是:前期我带节奏,中期大家一起稳住,后期全力肝一个题,不看手速,打正确率. /话说我好像是第一次用ACM格式写游记呢啊

hdu6206 Apple 2017 ACM/ICPC Asia Regional Qingdao Online

地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=6206 题目: Apple Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 530    Accepted Submission(s): 172 Problem Description Apple is Taotao's favouri

2017 ACM/ICPC Asia Regional Shenyang Online spfa+最长路

transaction transaction transaction Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 132768/132768 K (Java/Others)Total Submission(s): 1496    Accepted Submission(s): 723 Problem Description Kelukin is a businessman. Every day, he travels arou

poj 5024&amp;&amp;&amp;2014 ACM/ICPC Asia Regional Guangzhou Online 1003(预处理)

http://acm.hdu.edu.cn/showproblem.php?pid=5024 分析:预处理每个点在八个方向的射线长度,再枚举八种L形状的路,取最大值. 注意题意是求一条最长路,要么一条直线,要么只有一个90角,即L型.其实直线就是L形的一个方向长度为0. 代码: #include<iostream> #include<map> #include<cstdio> #include<string> #include<cstring>

2016 ACM/ICPC Asia Regional Shenyang Online 1009/HDU 5900 区间dp

QSC and Master Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 859    Accepted Submission(s): 325 Problem Description Every school has some legends, Northeastern University is the same. Enter

2015 ACM/ICPC Asia Regional Changchun Online HDU 5444 Elven Postman【二叉排序树的建树和遍历查找】

Elven Postman Time Limit: 1500/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 591    Accepted Submission(s): 329 Problem Description Elves are very peculiar creatures. As we all know, they can live for a very

2014 ACM/ICPC Asia Regional Guangzhou Online Wang Xifeng&#39;s Little Plot HDU5024

一道好枚举+模拟题目.转换思维视角 这道题是我做的,规模不大N<=100,以为正常DFS搜索,于是傻乎乎的写了起来.各种条件限制模拟过程 但仔细一分析发现对每个点进行全部八个方向的遍历100X100X100^8 .100X100个点,每个点在走的时候8中选择,TLE 于是改为另一个角度: 以符合要求的点为拐弯点,朝两个垂直的方向走,求出最远的距离.这样只要对每个点各个方向的长度知道,组合一下对应的就OK. 避免了每个点深搜. PS:搜索的时候x,y写反了,导致构图出现问题,以后用[dy][dx]

HDU 5014 Number Sequence(2014 ACM/ICPC Asia Regional Xi&#39;an Online) 题解

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5014 Number Sequence Problem Description There is a special number sequence which has n+1 integers. For each number in sequence, we have two rules: ● ai ∈ [0,n] ● ai ≠ aj( i ≠ j ) For sequence a and sequ

2016 ACM/ICPC Asia Regional Shenyang Online 1007/HDU 5898 数位dp

odd-even number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 388    Accepted Submission(s): 212 Problem Description For a number,if the length of continuous odd digits is even and the length