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. 在Nginx上部署ThinkPHP,解决Pathinfo问题

    在Nginx上部署ThinkPHP,解决Pathinfo问题 事实上.要解决nginx不支持pathinfo的问题.有两个解决思路,一是不使用pathinfo模式,二是改动nginx的配置文件,使它支 ...

  2. vue 实现 扫二维码 功能

    前段时间一直在研究,如何通过 vue 调用 相机 实现 扫一扫的功能,但是查看文档发现,需要获取 getUserMedia 的属性值,但存在兼容性问题. 退而求其次,通过 h5plus 来实现. 1. ...

  3. [POI 2001+2014acm上海邀请赛]Gold Mine/Beam Cannon 线段树+扫描线

    Description  Byteman, one of the most deserving employee of The Goldmine of Byteland, is about to re ...

  4. DW格式与布局

  5. ASI和AFN实现POST异步请求的相同功能的代码

    I'm a newbie in obj-c and have been using asihttp for some of my projects. When doing a post request ...

  6. 浅谈C#中常见的委托

    一提到委托,浮现在我们脑海中的大概是听的最多的就是类似C++的函数指针吧,呵呵,至少我的第一个反应是这样的. 关于委托的定义和使用,已经有诸多的人讲解过,并且讲解细致入微,尤其是张子阳的那一篇.我就不 ...

  7. LeetCode(21)题解:Merge Two Sorted Lists

    https://leetcode.com/problems/merge-two-sorted-lists/ Merge two sorted linked lists and return it as ...

  8. linux下的文件和文件夹的权限问题

    1 文件和文件夹的权限 文件和文件夹的权限设置的根本目的是控制人对它们的访问. 2 用户分类 本文件的拥有者.本文件所属的grou.其它用户. 3 也就是说 在读写文件或者文件夹时,要看看自己是属于哪 ...

  9. mysql_proxy

    mysql_proxy中间件实现:读写分离.负载均衡. mysql_proxy中间件实现:读写分离.负载均衡. 负载均衡:给多台数据库,看能不能均匀的分给不同的数据库. 客户端连的是proxy,此时的 ...

  10. DEDE自定义表单显示提交时间|添加提交时间,获取ip的方法

    前提是后台自定义表单字段一定要有  “时间”,这里的acca_time <div class="tit">*咨询内容:</div> <div clas ...