http://codeforces.com/gym/102028


A. Xu Xiake in Henan Province

看起来像水题。乱搞一下,还真是。

#include<bits/stdc++.h>
using namespace std;
#define ll long long int main(){
int n;
while(~scanf("%d",&n)){
for(int i=;i<n;i++){
int cnt=;
for(int j=;j<;j++){
int t;
scanf("%d",&t);
if(t)
cnt++;
} string ans;
switch(cnt){
case :
ans="Typically Otaku";
break;
case :
ans="Eye-opener";
break;
case :
ans="Young Traveller";
break;
case :
ans="Excellent Traveller";
break;
case :
ans="Contemporary Xu Xiake";
break;
}
cout<<ans<<endl;
} }
}

I. Distance

看起来蛮暴力的?每次选离点多的那一侧最远的那个?(也就是轮流选)先莽一发。

差点被卡memset,还好发现得早……

居然忘记处理t组数据,都已经扫进来了!

#include<bits/stdc++.h>
using namespace std;
#define ll long long bool c[];
int x[]; int main(){
int t;
while(~scanf("%d",&t)){
while(t--){
int n;
scanf("%d",&n); memset(c,,sizeof(c[])*n);
memset(x,,sizeof(x[])*n); x[]=;
for(int i=;i<n-;i++){
int d;
scanf("%d",&d);
x[i+]=x[i]+d;
} printf("%d %d",,x[n-]);
c[]=c[n-]=; int cleft=,cright=; int i=,j=n-; ll ans=x[n-];
ll cur=x[n-]; while(cleft+cright<n){
if(cleft==cright){
ans+=cur;
if(x[i]-x[i-]<=x[j+]-x[j]){
//cur+=x[i]-x[i-1];
c[i]=;
i++;
cleft++;
}
else{
//cur+=x[j+1]-x[j];
c[j]=;
j--;
cright++;
}
}
else if(cleft<cright){
cur+=x[j+]-x[i];
ans+=cur; c[i]=;
i++;
cleft++;
}
else{
cur+=x[j]-x[i-];
ans+=cur; c[j]=;
j--;
cright++;
}
printf("% lld",ans);
//printf("cur=%lld\n",cur);
}
printf("\n");
}
}
} /*
1
8
7 6 5 4 5 6 7
*/

E. Resistors in Parallel

感觉像是选不超过n的最小的质因数连乘形成的乘积的因数。我们要求的还有某个数的所有因子求和。

这里给出一个定理:求 $36=2*2*3*3$ 的所有因子的和,当然是等于 $(1+2+2^2)*(1+3+3^2)$ 。(拆开立刻就知道非常显然!)

变成每一个质因子的等比数列求和再求积。由 $36=2^2*3^2$ ,得其所有因子的和等于 $(\frac{1*(1-2^3)}{1-2})*(\frac{1*(1-3^3)}{1-3})$ ,

其实就是 $\prod\frac{p^{\alpha+1}-1}{p-1}$ 。这这道题中, $\alpha=1$ ,所以就是 $\prod{(p+1)}$ ,啊!数学真好玩?!

那现在的问题是求不超过 $10^{100}$ 的质因数连乘。大数交给潘哥去做。


D. Keiichi Tsuchiya the Drift King

看起来像几何题……不知道是不是错觉。

Codeforces - Gym102028 - 2018 Jiaozuo Regional Contest的更多相关文章

  1. Gym 102028C - Supreme Command - [思维题][2018-2019 ACM-ICPC Asia Jiaozuo Regional Contest Problem C]

    题目链接:https://codeforces.com/gym/102028/problem/C Lewis likes playing chess. Now he has n rooks on th ...

  2. 2018-2019 ACM-ICPC, Asia Jiaozuo Regional Contest

    目录 Contest Info Solutions A. Xu Xiake in Henan Province D. Keiichi Tsuchiya the Drift King E. Resist ...

  3. 2018 ECNA Regional Contest J. Watch Where You Step

    题目链接:Watch Where You Step 题意 给定有向图的邻接矩阵,现在需要给该图增加边,使得如果两点可达必直接可达,求需要加边的数量. 题解 首先,如果给定 \(n\) 个结点的图中任意 ...

  4. 2018 ACM-ICPC Asia Beijing Regional Contest (部分题解)

    摘要 本文主要给出了2018 ACM-ICPC Asia Beijing Regional Contest的部分题解,意即熟悉区域赛题型,保持比赛感觉. Jin Yong’s Wukong Ranki ...

  5. The 2018 ACM-ICPC Asia Qingdao Regional Contest(部分题解)

    摘要: 本文是The 2018 ACM-ICPC Asia Qingdao Regional Contest(青岛现场赛)的部分解题报告,给出了出题率较高的几道题的题解,希望熟悉区域赛的题型,进而对其 ...

  6. The 2018 ACM-ICPC Asia Qingdao Regional Contest

    The 2018 ACM-ICPC Asia Qingdao Regional Contest 青岛总体来说只会3题 C #include<bits/stdc++.h> using nam ...

  7. Codeforces Round #604 (Div. 2) C. Beautiful Regional Contest

    链接: https://codeforces.com/contest/1265/problem/C 题意: So the Beautiful Regional Contest (BeRC) has c ...

  8. ACM-ICPC Asia Beijing Regional Contest 2018 Reproduction hihocoder1870~1879

    ACM-ICPC Asia Beijing Regional Contest 2018 Reproduction hihocoder1870~1879 A 签到,dfs 或者 floyd 都行. #i ...

  9. 2018 ICPC Pacific Northwest Regional Contest I-Inversions 题解

    题目链接: 2018 ICPC Pacific Northwest Regional Contest - I-Inversions 题意 给出一个长度为\(n\)的序列,其中的数字介于0-k之间,为0 ...

随机推荐

  1. python发声

    python发声 学习了:http://www.jb51.net/article/62644.htm import winsound winsound.Beep(600,1000) #其中600表示声 ...

  2. centos 7 -- Disk Requirements: At least 134MB more space needed on the / filesystem.

    用了幾年的centos7,今天執行yum update時,彈出一行有錯誤的提示:Disk Requirements:   At least 134MB more space needed on the ...

  3. [Testing] Config jest to test Javascript Application -- Part 3

    Run Jest Watch Mode by default locally with is-ci-cli In CI, we don’t want to start the tests in wat ...

  4. IOS自己主动布局中的浮动布局(6)----MyFloatLayout横空出世

    https://github.com/youngsoft/MyLinearLayout 前言 在MyLayout的6大布局中,每种布局都有不同的应用场景. 且每种布局的子视图的约束机制不一样:线性布局 ...

  5. 安卓2.3 js解析问题 split()

    安卓2.3版本号解析错误,split和parseInt都会把09和08都解析成0,07下面解析没有问题.解决的方法是直接取个位数. function getYMD(yMd){ var dArray=n ...

  6. sql server 关于表中只增标识问题 C# 实现自动化打开和关闭可执行文件(或 关闭停止与系统交互的可执行文件) ajaxfileupload插件上传图片功能,用MVC和aspx做后台各写了一个案例 将小写阿拉伯数字转换成大写的汉字, C# WinForm 中英文实现, 国际化实现的简单方法 ASP.NET Core 2 学习笔记(六)ASP.NET Core 2 学习笔记(三)

    sql server 关于表中只增标识问题   由于我们系统时间用的过长,数据量大,设计是采用自增ID 我们插入数据的时候把ID也写进去,我们可以采用 关闭和开启自增标识 没有关闭的时候 ,提示一下错 ...

  7. Distributed Management Task Force----分布式管理任务组

    http://baike.baidu.com/link?url=Y9HGLs8Qj6pXbbgY6xPdfiGDsQO8Eu1e80B4giQtQ_hAfGNF59byxnLoERYri4Duw7Gw ...

  8. SpringMVC框架下使用jfreechart绘制折线图,柱状图,饼状图

    java代码 @Controller public class CityAction { @Autowired private CityBiz cityBiz; //柱状图 @RequestMappi ...

  9. mybatis一对多

    mapper.xml <mapper namespace="com.oracle.dao.one2manyDao"> <resultMap type=" ...

  10. openwrt gstreamer实例学习笔记(五. gstreamer BUS)

    1)概述 BUS(总线) 是一个简单的系统,它采用自己的线程机制将一个管道线程的消息分发到一个应用程序当中.总线的优势是:当使用GStreamer的时候,应用程序不需要线程识别,即便GStreamer ...