以下所有AC题解程序来自“仙客传奇”团队。

A. Xu Xiake in Henan Province

AC的C++语言程序:

#include<iostream>
#include<string>
using namespace std;
string ans[]={"Typically Otaku",
"Eye-opener",
"Young Traveller",
"Excellent Traveller",
"Contemporary Xu Xiake"};
int main()
{int T;cin>>T;while(T--){int a[4],s=0;for(int i=0;i<4;i++){cin>>a[i];if(a[i]) s++;}cout<<ans[s]<<endl;}
}

AC的C++语言程序:

#include <iostream>using namespace std;int main(void) {int cnt, x;int t;scanf("%d", &t);while (t--) {cnt = 0;for (int i = 0; i < 4; i++) {scanf("%d", &x);if (x) cnt++;}if (cnt == 0) printf("Typically Otaku\n");else if (cnt == 1) printf("Eye-opener\n");else if (cnt == 2) printf("Young Traveller\n");else if (cnt == 3) printf("Excellent Traveller\n");else if (cnt == 4) printf("Contemporary Xu Xiake\n");}return 0;
}

B. Ultraman vs. Aodzilla and Bodzilla

题解链接:
【数学思维】【分类】codeforces102028B Ultraman vs. Aodzilla and Bodzilla
A-L CodeForces Gym 102028 简要题解
BCH 2018-2019 ACM-ICPC 焦作赛区 部分题解

C. Supreme Command

题解链接:
Gym 102028C - Supreme Command - [思维题][2018-2019 ACM-ICPC Asia Jiaozuo Regional Contest Problem C]
A-L CodeForces Gym 102028 简要题解
BCH 2018-2019 ACM-ICPC 焦作赛区 部分题解

D. Keiichi Tsuchiya the Drift King

AC的C++语言程序:

#include<bits/stdc++.h>
using namespace std;
const double eps=1e-1;
const double Pi=acos(-1.0);
int main()
{double a,b,r,d;int T;cin>>T;while(T--){cin>>a>>b>>r>>d;double ang=atan((a+r)/b);d=(d*Pi)/180;if(2*(d+ang)>=Pi) {printf("%.12f\n",sqrt(b*b+(a+r)*(a+r))-r);}else{ang=sin(d+ang);printf("%.12f\n",sqrt(b*b+(a+r)*(a+r))*ang-r);}}
}

AC的C++语言程序:

#include <iostream>
#include <cmath>using namespace std;const double PI = acos(-1.0);
const double EPS = 1e-14;inline int fixCmp(double a, double b) {if (fabs(a - b) <= EPS) return 0;else if (a > b) return 1;return -1;
}int main(void) {int t;double a, b, r, d;scanf("%d", &t);while (t--) {scanf("%lf%lf%lf%lf", &a, &b, &r, &d);double theta = d * PI / 180;double bound = -atan((a + r) / b);while (fixCmp(bound, 0) < 0) bound += PI / 2;if (fixCmp(theta, bound) >= 0) {printf("%.12f\n", sqrt((a + r) * (a + r) + b * b) - r);} else {printf("%.12f\n", b * sin(theta) + (a + r) * cos(theta) - r);}}return 0;
}

E. Resistors in Parallel

AC的Java语言程序:

import java.util.Scanner;
import java.math.BigInteger;
public class Main{static int prime[];static boolean table[];static final int maxn=1000;public static void main(String []args){Scanner in=new Scanner(System.in);int cnt=0;prime=new int[maxn];table=new boolean[maxn];for(int i=2;i<maxn;i++){if(!table[i]){prime[cnt++]=i;for(int j=2;i*j<maxn;j++)table[i*j]=true;}}BigInteger n,a,b,g;int T;T=in.nextInt();for(int s=0;s<T;s++){n=in.nextBigInteger();a=BigInteger.valueOf(1);b=BigInteger.valueOf(1);int num=0;while(true){a=a.multiply(BigInteger.valueOf(prime[num++]));if(a.compareTo(n)>0) break;}a=a.divide(BigInteger.valueOf(prime[--num]));for(int i=0;i<num;i++){b=b.multiply(BigInteger.valueOf(prime[i]*prime[i]-1));b=b.divide(BigInteger.valueOf(prime[i]-1));}g=a.gcd(b);System.out.println(a.divide(g)+"/"+b.divide(g));}}
}

AC的Java语言程序:

import java.util.Scanner;
import java.math.BigInteger;public class Main {private static int prime[];private static boolean notPrime[];private final static int LIM = 10000;private static int cur = 0;public static void main(String[] args) {Scanner in = new Scanner(System.in);// build prime tablenotPrime = new boolean[LIM];prime = new int[LIM];for (int i = 2; i < LIM; i++) {if (!notPrime[i]) prime[cur++] = i;for (int j = 0; j < cur; j++) {int tmp = prime[j] * i;if (tmp >= LIM) break;notPrime[tmp] = true;if (i % prime[j] == 0) break;}}// cntint t;BigInteger n;t = in.nextInt();for (int k = 0; k < t; k++) {n = in.nextBigInteger();BigInteger mx = BigInteger.valueOf(1), crt = BigInteger.valueOf(1);for (int i = 0; i < cur; i++) {BigInteger tmp = mx.multiply(BigInteger.valueOf(prime[i]));if (tmp.compareTo(n) > 0) break;crt = crt.add(crt.multiply(BigInteger.valueOf(prime[i])));mx = tmp;}BigInteger g = mx.gcd(crt);System.out.println(mx.divide(g) + "/" + crt.divide(g));}}
}

F. Honeycomb

AC的C++语言程序:

#include<bits/stdc++.h>
using namespace std;
const int maxn=10000+5;
int dx[]={-1,-1,1,1,-2,2};
int dy[]={-3,3,-3,3,0,0};
char gird[maxn][maxn];
int r,c;
bool vis[maxn][maxn];
struct Node
{int x,y,step;
};
Node str,ter;
int bfs()
{vis[str.x][str.y]=1;Node first=str,u,v;first.step=1;queue<Node> q;q.push(first);while(!q.empty()){u=q.front();q.pop();if(u.x==ter.x&&u.y==ter.y) return u.step;int dr,dc;for(int i=0;i<6;i++){dr=u.x+dx[i],dc=u.y+dy[i];if(gird[dr][dc]=='/'||gird[dr][dc]=='\\'||gird[dr][dc]=='-'||vis[dr+dx[i]][dc+dy[i]]) continue;v.x=dr+dx[i],v.y=dc+dy[i];v.step=u.step+1;q.push(v);vis[v.x][v.y]=1;}}return -1;
}
int main()
{int T;scanf("%d",&T);while(T--){scanf("%d%d",&r,&c);r=4*r+3,c=6*c+3;getchar();for(int i=0;i<r;i++){gets(gird[i]);for(int j=0;j<c;j++){if(gird[i][j]=='S') str.x=i,str.y=j;if(gird[i][j]=='T') ter.x=i,ter.y=j;vis[i][j]=false;}}printf("%d\n",bfs());}
}

AC的C++语言程序:

#include <iostream>
#include <queue>using namespace std;
const int LIM = 1e3;char dat[5 * LIM][7 * LIM];
int vis[5 * LIM][7 * LIM];
int rbound, down;
int t, r, c, stamp;
int sr, sc, tr, tc;
const int dr[] = {-2, 2, -1, -1, 1, 1};
const int dc[] = {0, 0, 3, -3, 3, -3};
struct Node {int cnt, r, c;Node(int nr = 0, int nc = 0, int ncnt = 0) {cnt = ncnt, r = nr, c = nc;}
};int bfs() {Node crt;crt.cnt = 1;crt.r = sr;crt.c = sc;queue<Node> q;q.push(crt);while (!q.empty()) {crt = q.front();q.pop();if (dat[crt.r][crt.c] == 'T') return crt.cnt;for (int i = 0; i < 6; i++) {int nr = crt.r + dr[i];int nc = crt.c + dc[i];if (nr >= 0 && nr < down && nc >= 0 && nc < rbound&& dat[nr][nc] == ' ' && vis[nr][nc] != stamp) {vis[nr][nc] = stamp;nr += dr[i], nc += dc[i];if (nr >= 0 && nr < down && nc >= 0 && nc < rbound&& vis[nr][nc] != stamp) {vis[nr][nc] = stamp;q.push(Node(nr, nc, crt.cnt + 1));}}}}return -1;
}inline void gl(char *cur) {char ch;while ((ch = getchar()) != '\n') *(cur++) = ch;
}int main(void) {scanf("%d", &t);for (stamp = 1; stamp <= t; stamp++) {scanf("%d%d", &r, &c);gl(dat[0]);for (int i = 0; i < r * 4 + 3; i++)gl(dat[i]);down = r * 4 + 3;rbound = 6 * c + 3;for (int i = 0; i < down; i++) {for (int j = 0; j < rbound; j++) {if (dat[i][j] == 'S')sr = i, sc = j;else if (dat[i][j] == 'T')tr = i, tc = j;}}printf("%d\n", bfs());// destroy S and Tdat[sr][sc] = ' ';dat[tr][tc] = ' ';}return 0;
}

G. Shortest Paths on Random Forests

题解链接:
A-L CodeForces Gym 102028 简要题解

H. Can You Solve the Harder Problem?

题解链接:
A-L CodeForces Gym 102028 简要题解
BCH 2018-2019 ACM-ICPC 焦作赛区 部分题解

I. Distance

AC的C++语言程序:

#include<iostream>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
ll p[maxn];int main()
{ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);int t,n,d;ll  ans,tmp;cin>>t;while(t--){cin>>n;for(int i = 2;i <= n;++i){cin>>d;p[i] = p[i - 1] + d;}int l = 1,r = n + 1;ans = 0,tmp = 0;cout<<"0";for(int i = 1;i < n;++i){if(i & 1){  tmp += p[--r] - p[l];ans += tmp;}else{++l;ans += tmp; }cout<<' '<<ans;    }cout<<endl;}return 0;
}

AC的C++语言程序:

#include <iostream>using namespace std;typedef long long LL;const LL LIM = 1e6;
LL dat[LIM];int main(void) {LL t, n, tmp, ans;scanf("%lld", &t);while (t--) {scanf("%lld", &n);LL cur = 0;dat[cur++] = 0;for (LL i = 1; i < n; i++) {scanf("%lld", &tmp);dat[cur] = dat[cur - 1] + tmp;cur++;}LL left = 0, right = cur;printf("0");ans = tmp = 0;for (LL i = 1; i < n; i++) {if (i & 1) {ans += tmp;ans += dat[--right] - dat[left];tmp += dat[right] - dat[left];} else {ans += tmp;left++;}printf(" %lld", ans);}putchar('\n');}return 0;
}

AC的C++语言程序:

#include<bits/stdc++.h>using namespace std;const int maxn=1e5+5;typedef long long ll;ll a[maxn];int main()
{int T;scanf("%d",&T);while(T--){int n;ll sum=0;scanf("%d",&n);for(int i=1;i<n;i++){scanf("%lld",&a[i]);sum+=a[i];}ll tt=0,tmp=0;int l=1,r=n-1;for(int i=1;i<=n;i++){if(i&1){tmp+=tt;}else{tt+=sum;sum-=a[l];l++;sum-=a[r];r--;tmp+=tt;}if(i==1){printf("%lld",tmp);}else{printf(" %lld",tmp);}}printf("\n");}return 0;
}

J. Carpets Removal

题解链接:
Gym102028J
A-L CodeForces Gym 102028 简要题解

K. Counting Failures on a Trie

题解链接:
A-L CodeForces Gym 102028 简要题解

L. Connected Subgraphs

题解链接:
A-L CodeForces Gym 102028 简要题解

题解连接:
ADEFI CodeForces GYM 102028 2018-2019 ACM-ICPC, Asia Jiaozuo Regional Contest
A-L CodeForces Gym 102028 简要题解
BCH 2018-2019 ACM-ICPC 焦作赛区 部分题解

2018-2019 ACM-ICPC, Asia Jiaozuo Regional Contest题解相关推荐

  1. 2016 ACM / ICPC Asia dalian Regional Contest 题解(11 / 11)【每日亿题2021 / 2 / 17】

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 A .(2017 ACM ICPC dalian H)To begin or not to be ...

  2. 2017 ACM ICPC Asia Shenyang Regional Contest 题解(10 / 13)【每日亿题2 / 16】

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 A.(2017 ICPC shenyang I)Little Boxes B.(2017 ICP ...

  3. The 2019 ICPC Asia Shanghai Regional Contest

    The 2019 ICPC Asia Shanghai Regional Contest 题号 题目 知识点 A Mr. Panda and Dominoes B Prefix Code C Maze ...

  4. 2018 ICPC Asia Jakarta Regional Contest

    2018 ICPC Asia Jakarta Regional Contest 题号 题目 知识点 难度 A Edit Distance B Rotating Gear C Smart Thief D ...

  5. 【题目记录】——The 2021 ICPC Asia Jinan Regional Contest

    文章目录 C Optimal Strategy 组合数 H Game Coin K Search For Mafuyu 欧拉序列 题目集地址 The 2021 ICPC Asia Jinan Regi ...

  6. 2018-2019 ACM-ICPC, Asia Nanjing Regional Contest题解

    以下所有AC题解程序来自"仙客传奇"团队. AC题数:6/13 ADGIJK A. Adrien and Austin AC的C++语言程序: #include <iostr ...

  7. 2018 ACM-ICPC Asia Beijing Regional Contest题解

    以下所有AC题解程序来自"仙客传奇"团队. A. Jin Yong's Wukong Ranking List AC的C++语言程序: #include <iostream& ...

  8. 2019-2020 ICPC Asia Xuzhou Regional Contest【徐州现场赛】

    题目: 209-2020 ICPC Asia Xuzhou Regional Onsite Contest E. Multiply 题意: 找到最大的 i 使得 z*x^i 是 y! 的因子 分析: ...

  9. 2018 ACM-ICPC Asia Shenyang Regional Contest 题解(9 / 13)【每日亿题2021/2/24】

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 A.(2018 ACM-ICPC Shenyang J)How Much Memory Your ...

最新文章

  1. 利用python安装opencv_Linux下安装OpenCV+Python支持
  2. layuiajax提交表单控制层代码_究竟怎么用Restful风格编代码必看这篇。(二)
  3. 关于“wap2app仅支持对已通过ICP备案的域名站点进行打包”问题解决
  4. STM32-GPIO篇
  5. 后端开发(1)---大话后端开发的技巧大集合
  6. Flutter基础—布局模型之滚动块
  7. 最新中文文本挖掘小例子及程序
  8. 【每日算法Day 85】图解算法:一行代码解决约瑟夫环的变体
  9. 排序算法之三 选择排序(C++版本)
  10. uploadify组件文件上传那些事
  11. IDEA社区版利用maven创建web
  12. 麻理工MIT的脑计划eyewire (顺便学习一下医学影像知识)
  13. 【BZOJ4200】【NOI2015】小园丁与老司机(动态规划,网络流)
  14. 让人醍醐灌顶的线性代数视频,深刻理解线性代数
  15. 用BWA进行序列比对
  16. 轮播图的做法(更换背景图片)
  17. 个人永久性免费-Excel催化剂功能第24波-批量发送邮件并指点不同附件不同变量...
  18. 焊接过程计算机模拟研究,焊接过程的数值模拟
  19. 模拟集成电路设计学习笔记(一)IC617工艺库安装
  20. stata最大值最小值命令_stata基本操作来袭,简单易学,必看!

热门文章

  1. SpringBoot开发流程
  2. DXUT框架剖析系列文章(原创:天行健 君子当自强而不息)
  3. 【java奇思妙想】使用多线程的思想来实现java网络编程接收和发送的问题
  4. lpc2000 filash utility 程序烧写工具_重点必看 | 取证小程序开发之第四届美亚杯硬盘信息快速解题...
  5. html dom子节点,HTML DOM 节点
  6. Doris FE配置参数(全面)
  7. CDH集群禁用kerberos的讲解
  8. 怎样更改itunes备份位置_iphone备份太大,严重挤占C盘空间,怎么把备份放在其他的硬盘?...
  9. 谈谈基类与子类的this指针(C++)
  10. dll创建及调用(VS2005)