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中pymysql使用

    python中pymysql使用 https://blog.csdn.net/johline/article/details/69549131 import pymysql # 连接数据库 conne ...

  2. react 中的无状态函数式组件

    无状态函数式组件,顾名思义,无状态,也就是你无法使用State,也无法使用组件的生命周期方法,这就决定了函数组件都是展示性组件,接收Props,渲染DOM,而不关注其他逻辑. 其实无状态函数式组件也是 ...

  3. MongoDB:数据模型介绍

    在MongoDB的数据有灵活的模式.不像SQL数据库,(SQL数据库)要求你必须在插入数据之前决定和声明一个表的模式.MongoDB的集合不强制文档的结构.这个灵活性有利于文档到实体或对象的映射. 每 ...

  4. 一个TAB的jquery简单写法

    <style> .honver{ color:red;} </style><script src="../js/jquery-1.9.0.min.js" ...

  5. HDU 1312 Red and Black 第一题搜索!

    Red and Black Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

  6. break 用法

    // break 在循环中的功能测试 # include <stdio.h> int main(void){ int i, j; for (i = 0; i<3; ++i) {  j ...

  7. Codeforces 3A-Shortest path of the king(BFS打印路径)

    A. Shortest path of the king time limit per test 1 second memory limit per test 64 megabytes input s ...

  8. winfrom桌面程序调用python解释器

    Winfrom桌面程序调用python解释器执行py脚本后台执行完成具体的功能,为什么要这样处理呢?因为我现在的大部分过项目都是后台的脚本处理,界面基本的输入完成之后,将参数按照规则传入到脚本的入口, ...

  9. CodeChef - COUNTARI FTT+分块

    Arithmetic Progressions Given N integers A1, A2, …. AN, Dexter wants to know how many ways he can ch ...

  10. bash exec

    1 当exec执行命令时,会为该命令创建shell进程,并且终止老的shell进程的执行,并且保留老的shell进程的进程号 [root@localhost ~]# cat test_exec.sh ...