[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=3942 [算法] 栈 + KMP [代码] #include<bits/stdc++.h> using namespace std; #define MAXN 1000010 int i,pos,top,ls,lt; int nxt[MAXN],p[MAXN]; char S[MAXN],T[MAXN],ans[MAXN]; int stk[MAXN]; int main() {…
[Description] N (3 ≤ N ≤ 20000) ping pong players live along a west-east street(consider the street as a line segment).Each player has a unique skill rank. To improve their skill rank, they often compete with each other. Iftwo players want to compete…
[题意] 秦始皇要在n个城市之间修路,而徐福声可以用法术位秦始皇免费修1条路,每个城市还有人口数,现要求徐福声所修之路的两城市的人口数之和A尽量大,而使n个城市互通需要修的路长B尽量短,从而使得A/B最大.问A/B最大是多少?(1000个城市) InputThe first line contains an integer t meaning that there are t test cases (t ≤ 10).For each test case:The first line is an…