自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

无限迭代中......

你已经是一个成熟的程序猿了,要学会自己DEBUG了。

  • 博客(99)
  • 资源 (3)
  • 收藏
  • 关注

原创 Prefix Sum Primes

https://codeforces.com/contest/1150/problem/C题解:思维+贪心按2 1 2 2 2 ...... 1 1 1 1就可以了/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algo...

2019-04-30 20:03:50 465

原创 Tiling Challenge

https://codeforces.com/contest/1150/problem/B题解:朴素/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib>...

2019-04-30 20:02:21 332

原创 Stock Arbitraging

https://codeforces.com/contest/1150/problem/A题解:朴素/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib>...

2019-04-30 19:16:04 258

原创 线段树——区间离散化/压缩

一、基本概念线段树:线段树基本概念离散化:把无限空间中有限的个体映射到有限的空间中去,以此提高算法的时空效率。通俗的说,离散化是在不改变数据相对大小的条件下,对数据进行相应的缩小。例如:原数据:1,999,100000,15;处理后:1,3,4,2;原数据:{100,200},{20,50000},{1,400};处理后:{3,4},{2,6},{1,5};二...

2019-04-30 17:56:49 789

原创 回文字符串(Palindromic_String)

一、基本概念回文字符串:是一个正读和反读都一样的字符串。二、问题与算法(1)判断思想:1、初始化标志flag=true;2、输入字符串str,并获取其长度len;3、定义并初始化游标i=0,j=len-1,分别指向字符串开头和末尾;4、比较字符str[i]和str[j],若i==j,转至7,否则往下执行5;5、若str[i]和str[j]相等...

2019-04-30 17:07:49 62859

原创 Strings in the Pocket

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4110题意:反转某一个区间的子字符串,使得两个字符串相同题解:1、判断两个字符串是否完全相同;2、完全相同则Manacher's Algorithm求回文字符串数量;3、不完全相同则分别从头从尾至不相同得到区间[l,r],反转这个区间判断是否和另一个字符串...

2019-04-28 20:19:29 463

原创 Welcome Party

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4109题意:n个人参加会议,如果当参与者进入大厅时,如果他或她发现他或她的朋友都不在大厅中,那么即使他或她的朋友稍后将进入大厅,该参与者也会感到不快乐。求最小化不满意参与者数量,并给出一个入场顺序,如果存在多个答案,输出字典序最小的顺序题解:并查集+优先队列不要用...

2019-04-28 20:14:32 235

原创 Fibonacci in the Pocket

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4108题意:求斐波那契数列区间[l,r]之和的奇偶性题解: 规律1、斐波那契数列奇偶性为 1 1 0 1 1 0 1 1 0 ......;2、在区间,如果时为奇数,时为偶数;3、询问一个数的余数=各位数字之和;4、奇数-奇数=奇数,偶数-偶数=偶数,...

2019-04-28 20:11:47 303

原创 Singing Everywhere

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4107题意:至多删除一个点,使得破音数量最少题解:前缀+后缀+枚举/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#i...

2019-04-28 20:03:10 282

原创 Lucky 7 in the Pocket

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4106题意:求大于等于n的最小可以被7整除不能被4整除的数题解:预处理+二分/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream&g...

2019-04-28 20:02:27 420

原创 Abbreviation

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4105题意:删去除第一个字符以外,所有的元音字母题解:模拟/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#inclu...

2019-04-28 20:01:51 428

原创 Sequence in the Pocket

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4104题解:排序,查找有多少是不需要操作的/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algor...

2019-04-28 20:01:10 215

原创 Element Swapping

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4101题意:数组a通过交换一对数字,得到了b数组,给出x=和y=和b数组,问有多少对l,r(l<=r)能满足条件C++版本一题解:规律+数学1、;2、;3、,则;4、,则不合法数据;5、,,则不合法数据;6、,,对于某一个位置i,可以...

2019-04-28 20:00:03 593 2

原创 The 16th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple

Problem AVertices in the Pocket比赛地址:http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5989补题地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4100Problem BElemen...

2019-04-27 06:47:08 614 2

原创 Inverse of Rows and Columns

https://codeforces.com/contest/1157/problem/GC++版本一题解:暴力/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstd...

2019-04-27 06:35:38 386

原创 Maximum Balanced Circle

https://codeforces.com/contest/1157/problem/F题意:求一个相邻元素之间绝对值为小于1的最大环题解:1、桶排序;2、环肯定在没有或者数量为1的元素之间;/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream&g...

2019-04-27 04:37:57 319

原创 Minimum Array

https://codeforces.com/contest/1157/problem/E题意:重新排序b数组,使得ci=(ai+bi)%n的字典序最小题解:用multiset存储b数组,lower_bound查询,不要用vector,容易TLE/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>...

2019-04-27 04:37:48 442

原创 N Problems During K Days

https://codeforces.com/contest/1157/problem/D题意:找到一个长度为k的元素大于0的数组,并且,整个数组的和等于n题解:因为数组严格递增,数组最小和k*(k+1)/2,而i-n的最小和为(k-i+1)*(k-i+2)/2,对于这个公式可以加上一个首项,增加i-n的和,对第i个元素在i-n的和不应该大于剩下未分配的n,当然应该满足/**@Au...

2019-04-27 04:37:40 475

原创 Increasing Subsequence (hard version)

https://codeforces.com/contest/1157/problem/C2题意:给一个存在重复的元素的数组,每次可以在头或者尾取一个数,求取数最长严格递增序列的方法题解:因为如果存在两端元素相同的情况,只能取一端,因为序列严格递增,必然不可能再取另一端的数,因此当相同时,左右分别暴力即可/**@Author: STZG*@Language: C++*/...

2019-04-27 04:37:32 405

原创 Increasing Subsequence (easy version)

https://codeforces.com/contest/1157/problem/C1题意:给一个不重复的元素的数组,每次可以在头或者尾取一个数,求取数最长严格递增序列的方法题解:因为元素不重复,每次选大于上一个值,而且绝对值相对较小的/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#i...

2019-04-27 04:37:27 403 1

原创 Long Number

https://codeforces.com/contest/1157/problem/B题意:用给定的代替数组,替换数字字符串的一段连续的区间,使得数字字符串字典序最大题解:找到第一个替换以后字典序增加的字符,开始连续替换,直到字符串结尾或者替换以后小于之前一个字符串/**@Author: STZG*@Language: C++*/#include <bits/...

2019-04-27 04:37:18 1137

原创 Reachable Numbers

https://codeforces.com/contest/1157/problem/A题意:对n进行+1操作,如果有末尾0,就删除,求可以变化的所有不含末尾0的元素个数。题解:暴力模拟,set计数。/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream&...

2019-04-27 04:37:09 656

原创 Memory Banks

http://acm.hdu.edu.cn/showproblem.php?pid=6501题解:尽量取大的内存/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdli...

2019-04-26 14:32:40 528

原创 模拟电梯2.0(继承机制实验)

浙江理工大学信息学院实验指导书实验名称:类的继承机制的实现 学时安排:3实验类别:设计性实验 实验要求:1人1组  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄一、实验目的1.掌握单继承和多重继承的概...

2019-04-25 21:31:29 2554 1

原创 欧几里得算法和扩展欧几里得算法(Euclidean_Algorithm and Extended_Euclidean_Algorithm)

一、基本概念欧几里得算法:又名辗转相除法,计算两个整数a,b的最大公约数。扩展欧几里得算法:对于不完全为 0 的非负整数 a,b,gcd(a,b)表示 a,b 的最大公约数,必然存在整数对 x,y ,使得 gcd(a,b)=ax+by。二、基本性质gcd函数的基本性质:gcd(a,b)=gcd(b,a)=gcd(-a,b)=gcd(|a|,|b|)贝祖定理:即如果a、b是整数...

2019-04-25 20:53:48 1531

原创 Schedule

http://acm.hdu.edu.cn/showproblem.php?pid=6180题意:已知一些任务的开始时间和结束时间,一台机器同时只能运行一个任务(机器中间不关闭运行),求在使用最少机器工作的前提下机器工作的最短时间题解:将开始时间标记为1,结束时间标记为-1。按照时间大小对这2n2n个时间从小到大排序,然后遍历计算前缀和,当前缀和每次增加1的时候,说明需要新开一台机器...

2019-04-25 20:39:58 572

原创 2019黑龙江大学程序设计竞赛

Problem AFind the Nth Characterhttps://ac.nowcoder.com/acm/contest/877/A题意:定义一个字符串,求第n个字符是什么题解:打表C++版本一/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<i...

2019-04-25 19:04:03 1211

原创 Neko and Aki's Prank

https://codeforces.com/contest/1152/problem/D题解:DP+规律/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib&...

2019-04-25 13:02:11 543

原创 Neko does Maths

https://codeforces.com/contest/1152/problem/C题解:扩展欧几得里定理/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstd...

2019-04-25 13:02:08 457

原创 Neko Performs Cat Furrier Transform

https://codeforces.com/contest/1152/problem/B题解:模拟+贪心/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib&g...

2019-04-25 12:13:55 327

原创 Neko Finds Grapes

https://codeforces.com/contest/1152/problem/A题解:思维/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib>...

2019-04-25 12:11:47 428

原创 [BeiJing2010组队]次小生成树 Tree

https://www.lydsy.com/JudgeOnline/problem.php?id=1977题解:次小生成树/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<c...

2019-04-24 18:30:38 253

原创 The Unique MST

http://poj.org/problem?id=1679题解:次小生成树C++版本一Prim算法/**@Author: STZG*@Language: C++*///#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdli...

2019-04-23 19:36:55 410

原创 Beautiful Array

https://codeforces.com/contest/1155/problem/D题解:DP1、最大连续区间和=当前i前缀和-min{0-i-1前缀和};2、定义三个数组,分别为:1、从没有加x;2、已经x并且持续到当前i位置;3、已经加x但是当前i位置不加x;3、long long 是必要的;/**@Author: STZG*@Langua...

2019-04-23 01:25:31 261

原创 Alarm Clocks Everywhere

https://codeforces.com/contest/1155/problem/C题解:1、对x数组求差;2、对x数组差求GCD;3、暴力查找p数组有没有GCD%pi==0;/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#in...

2019-04-23 01:17:43 320

原创 Game with Telephone Numbers

https://codeforces.com/contest/1155/problem/B题解:1-n-11之间的8的数量大于可移除的数量/2/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#in...

2019-04-23 01:10:52 453

原创 Reverse a Substring

https://codeforces.com/contest/1155/problem/A题解:找到两个字符逆序就行/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstd...

2019-04-23 01:07:44 552

原创 浙江理工大学2019年4月赛

Problem A我不会做比赛地址:http://47.96.116.66/problem.php?cid=1222&pid=0补题地址:http://47.96.116.66/problem.php?id=1908题解:1、按题意输出,请注意”??(“一起输出, 在评测中会被当成’[‘,所以要分开输出;2、看清楚什么时候向上取整,什么时候向下取整;3、二进制1...

2019-04-21 18:26:08 1966 1

原创 The Preliminary Contest for ICPC China Nanchang National Invitational

Problem APERFECT NUMBER PROBLEMhttps://nanti.jisuanke.com/t/38220题解:打表/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#...

2019-04-20 11:46:36 279

原创 2019中山大学程序设计竞赛

Problem A题意:有一个长度为n的随机排列以及m个min、max操作。问最后一个操作的结果的期望 * n! 的结果。题解:枚举k,考虑计算结果 >= k 的排列有几个。此时数字本质上只有两类,>= k 的以及 < k的。可以2^n的枚举每个位置的数是>=k还是<k,然后对于每一个状态模拟一遍所有m个操作,如果结果为1,则说明该状态是可行的。...

2019-04-19 16:54:59 782

浙江理工大学-网页设计与建设.rar

2018-2019学年第二学期-浙江理工大学-网页设计与建设-上交期末作业样本 浙江理工大学-网页设计与建设.rar

2019-06-23

C++课程设计-模拟电梯

编写一个程序,模拟电梯的功能。功能接口包括电梯上行按钮、下行按钮、楼层选择和电梯在行驶过程中的楼层显示。

2019-05-14

C++课程设计-便利店管理系统.rar

通过设计一个小型的便利店管理系统,训练综合运用所学知识处理实际问题的能力,强化面向对象的程序设计理念,使自己的程序设计与调试水平有一个明显的提高。

2019-05-14

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除