- 博客(140)
- 资源 (3)
- 收藏
- 关注
原创 Equalize Them All
https://codeforces.com/contest/1144/problem/D题意:给定数组,进行操作:要求将数组元素变成全部相同,保证可以完成,给出操作序列(注意操作过程中数组的数字不能超过10^18)题解:找到一个众数,向两边操作/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>...
2019-03-31 23:29:53 317
原创 Two Shuffled Sequences
https://codeforces.com/contest/1144/problem/C题意:给定一个序列,将它拆成两个序列,一个严格递增,一个严格递减。不能输出“No”。(一个数字的序列和空序列符合递增和递减要求题解:正向一遍,逆向一遍/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#in...
2019-03-31 22:58:15 300
原创 Parity Alternated Deletions
https://codeforces.com/contest/1144/problem/B题意:给定一个数组,进行操作:每次删除一个数,但是删除的数的奇偶性要与上一次相反。求删除后剩下的数的最小和题解:两个队列,先删元素多的/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<...
2019-03-30 21:47:26 341
原创 Diverse Strings
https://codeforces.com/contest/1144/problem/A题意:给定字符串,判断字符串中的字母是否只出现一次且出现的字母是连续的题解:排序,证明连续/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include...
2019-03-30 21:47:17 279
原创 Queen
https://codeforces.com/contest/1143/problem/C题解:DFS/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib>...
2019-03-30 21:47:03 352
原创 Nirvana
https://codeforces.com/contest/1143/problem/B题解:数位DP/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib&g...
2019-03-30 21:46:39 301
原创 The Doors
https://codeforces.com/contest/1143/problem/A/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib>#inclu...
2019-03-30 21:46:29 262
原创 冰岛人
https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858887C++版本一题解:LCA25分满分题解:1、map映射分配ID,只要给名分配就行了;2、起源人的姓相同不算是同一个家族;3、数据存在性别为女的节点有子节点,此时子节点作为起源人处理;4、存在多个起源人5、并查集路...
2019-03-30 21:46:17 1643 1
原创 彩虹瓶
https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858889题解:栈+队列/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<alg...
2019-03-30 21:23:39 1587
原创 深入虎穴
https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858888C++版本一题解:DFS/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#includ...
2019-03-30 21:08:51 1493
原创 特立独行的幸福
https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858886题解:暴力/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<alg...
2019-03-30 20:42:27 1213
原创 Nearest Common Ancestors
http://poj.org/problem?id=1330题解:LCA树上倍增/**@Author: STZG*@Language: C++*///#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib>#inclu...
2019-03-30 12:05:06 141
原创 估值一亿的AI核心代码
https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858885题解:/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorit...
2019-03-29 23:19:15 1046
原创 吃鱼还是吃肉
https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858884题解:/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorit...
2019-03-29 23:19:02 719
原创 幸运彩票
https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858883题解:/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorit...
2019-03-29 23:18:40 3678
原创 新胖子公式
https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858882题解:/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorit...
2019-03-29 23:18:13 1458
原创 心理阴影面积
https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858881题解:几何计算/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<alg...
2019-03-29 23:18:03 1144
原创 敲笨钟
https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858880题解:思维/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algor...
2019-03-29 23:17:53 474
原创 6翻了
https://pintia.cn/problem-sets/994805046380707840/problems/1111914599408664577题解:暴力/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algor...
2019-03-29 23:17:43 731
原创 PTA使我精神焕发
https://pintia.cn/problem-sets/994805046380707840/problems/1111914599408664576题解:/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorit...
2019-03-29 23:17:32 821
原创 工人类与工资类
main.cpp/**@Author: STZG*@Language: C++*/#include<iostream>#include "worker.h"#include "salary.h"using namespace std;int main(){ char name[100],dept[100]; int ag...
2019-03-29 23:15:13 560 1
原创 模拟电梯1.0(类与对象实验)
浙江理工大学信息电子学院实验指导书实验名称:类的定义与使用 学时安排:3实验类别:设计性实验 实验要求:1人1组  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄一、实验目的1)掌握类的概念、...
2019-03-29 21:16:37 3671 9
原创 CD操作
http://acm.hdu.edu.cn/showproblem.php?pid=4547C++版本一题解:LCA树上倍增注意:CD 向下走可以一步到底/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algor...
2019-03-28 21:58:44 389
转载 矩阵构造方法
一、矩阵乘法https://blog.csdn.net/weixin_43272781/article/details/82899737二、矩阵构造方法Fibonacci数列:F(0)=1 , F(1)=1 , F(n)=F(n-1)+F(n-2)我们以前快速求Fibonacci数列第n项的方法是 构造常系数矩阵(一) Fibonacci数列f[n]=f[n-1]+f[n...
2019-03-28 20:58:45 791
原创 Connections between cities
http://acm.hdu.edu.cn/showproblem.php?pid=2874题解:LCA参考文章:https://blog.csdn.net/weixin_43272781/article/details/88797088/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#in...
2019-03-27 17:16:25 326
原创 Hangover
http://poj.org/problem?id=1003题解:/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib>#include<cstri...
2019-03-27 15:28:40 319
原创 487-3279
http://poj.org/problem?id=1002题解:/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib>#include<cstri...
2019-03-27 15:24:59 248
原创 RMQ问题
一、基本定义RMQ (Range Minimum/Maximum Query)问题是指:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j<=n),返回数列A中下标在i,j里的最小(大)值,也就是说,RMQ问题是指求区间最值的问题。二、算法(1)朴素复杂度:O(n)-O(qn)(2)线段树复杂度:O(n)-O(qlogn)参考文章:https://bl...
2019-03-27 14:22:09 1222
原创 Save your cats
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2224题意:n个木桩,给出他们的坐标,一些木桩之间连着m个篱笆,组成了多个封闭区域,每个封闭区域里面有猫,要将猫救出来,至少拆多长的篱笆也就是n个顶点、m条边的图,要使图中没有圈,需要去掉的边的权值至少为多少?题解:最小生成树+并查集求图的最大生成树,总权值-生成...
2019-03-26 23:36:17 258
原创 Road Construction
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2249题意:出若干个建筑之间的一些路,每条路都有对应的长度和需要的花费,问在保证源点1 到其他个点的距离最短的情况下,最少的花费是多少题解:最短路C++版本一/**@Author: STZG*@Language: C++*/#include <bi...
2019-03-26 23:17:21 640
原创 Electrification Plan
http://acm.timus.ru/problem.aspx?space=1&num=1982题解:最小生成树/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<c...
2019-03-26 21:49:26 230
原创 Ant Trip
http://acm.hdu.edu.cn/showproblem.php?pid=3018题解:/*一笔画问题:每条边过且只过一次,问至少要画几笔才能全部边都经过(不考虑鼓励的点) 图有多个集合构成集合有两种 一种为含奇数点的一种为只含偶数点的 对于含奇数点的笔画数=奇数点个数/2 对于只含偶数点的存在欧拉回...
2019-03-26 21:11:09 274
原创 Watchcow
http://poj.org/problem?id=2230C++版本一参考文章:https://blog.csdn.net/weixin_43272781/article/details/88553573题解:vector 存边+欧拉回路/**@Author: STZG*@Language: C++*///#include <bits/stdc++.h>...
2019-03-26 20:15:39 227
原创 欧拉回路
http://acm.hdu.edu.cn/showproblem.php?pid=1878题解:欧拉回路参考文章:https://blog.csdn.net/weixin_43272781/article/details/88553573/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#in...
2019-03-26 19:48:26 265
原创 逃生
http://acm.hdu.edu.cn/showproblem.php?pid=4857题解:逆向拓扑排序/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib...
2019-03-26 19:09:44 306
原创 确定比赛名次
http://acm.hdu.edu.cn/showproblem.php?pid=1285题解:拓扑排序因为要最小序列所以引入优先队列然后关系可能存在重复/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algori...
2019-03-26 18:34:32 313
原创 Ordering Tasks
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1246C++版本一题解:拓扑排序/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>...
2019-03-26 18:19:24 196
原创 Catch
http://acm.hdu.edu.cn/showproblem.php?pid=3478题解:在做这道题目之前,需要了解一下二部图的一些性质,如果一幅图为二部图的充分必要条件是,这幅联通图的任意一个环都为偶数环。 相对于,题目所要求的,要使得他能够在偶数时刻以及奇数时刻出现在同一点上,需要的是这个环必须是奇数环,因为奇数环的话,才能使得,在偶数或者奇数时刻出现在环上任意的同一点上...
2019-03-25 23:39:27 162
原创 How Many Tables
http://acm.hdu.edu.cn/showproblem.php?pid=1213题解:并查集/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib>...
2019-03-25 22:33:21 100
原创 [USACO1.5]特殊的质数肋骨 Superprime Rib
https://www.luogu.org/problemnew/show/P1218/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib>#include&...
2019-03-25 16:03:17 356
C++课程设计-便利店管理系统.rar
2019-05-14
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人