自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

ZJ_MRZ的博客

C++爱好者,欢迎一起讨论!

  • 博客(45)
  • 收藏
  • 关注

原创 Alien 的数列

DP好题:Alien 的数列题解题目背景Alien 们很迷信,所以对于一个数列,它们如果觉得它不吉利,就要将这个数列进行处理,但处理方式很诡异。题目描述对于一个数列 A1, A2, A3 … AN,如果它不是不下降的,那么 Alien们就认为这个是不吉利的。Alien 们要尽力把不吉利的数列修改成为吉利的,可以把这个数列的中的某个数修改为 New,代价是|Ai-New|。 现在它们委托你帮...

2019-11-04 14:23:30 444

原创 牛客CSP-S提高组赛前集训营1-仓鼠的石子游戏

牛客CSP-S提高组赛前集训营1-仓鼠的石子游戏题目描述仓鼠和兔子被禁止玩电脑,无聊的他们跑到一块空地上,空地上有许多小石子。兔子捡了很多石子,然后将石子摆成n个圈,每个圈由a[i]个石子组成。然后兔子有两根彩色笔,一支红色一支蓝色。兔子和仓鼠轮流选择一个没有上色的石子涂上颜色,兔子每次可以选择一个还未染色的石子将其染成红色,而仓鼠每次可以选择一个还未染色的石子将其染成蓝色,并且仓鼠和兔子约定...

2019-11-04 07:57:25 253

原创 个人公开题库传送门

传送门ACM与OI选手均适合。题库正在完善中……此题库基于洛谷的个人邀请赛。

2019-11-03 14:28:44 319

原创 提高组OI的一些实用模板

文章目录【模板】KMP字符串匹配题目描述输入格式输出格式输入输出样例输入 #1输出 #1代码【模板】KMP字符串匹配题目描述如题,给出两个字符串s1和s2,其中s2为s1的子串,求出s2在s1中所有出现的位置。为了减少骗分的情况,接下来还要输出子串的前缀数组next。(如果你不知道这是什么意思也不要问,去百度搜[kmp算法]学习一下就知道了。)输入格式第一行为一个字符串,即为s1第二...

2019-10-21 21:45:09 400

原创 退役生涯&Day 1

退役生涯&Day 1【LGR-061】洛谷10月月赛 II & X Round 4 Div.2T1 【XR-4】模拟赛题目描述输入格式输入输出样例输入 #1输出 #1输入 #2输出 #2输入 #3输出 #3思路代码【XR-4】歌唱比赛【LGR-061】洛谷10月月赛 II & X Round 4 Div.2T1 【XR-4】模拟赛题目描述X 校正在进行 CSP 前的...

2019-10-20 21:35:45 557

原创 2019初赛复习

2019初赛复习计算机基础计算机常识数据库与数据结构关系数据库层次数据库网状数据库二维表树链接指针数据库软件有哪些?名字里带 SQLOracle By 甲骨文ACCESS By 微软DB2 By IBMFoxPro与FoxBase计算机发展史代别年代逻辑(电子)元件第一代1946–1958(40年代开始)电子管第...

2019-10-20 19:07:55 305

原创 OI或ACM比赛前的代码模板

定义了一些常见的语句,如memset,forint与long long 的快速读入// ZJ_MRZ's Code#include<iostream>#include<cstdio>#include<algorithm>#include<cmath>#include<strin

2019-02-01 23:02:27 370

原创 CodeForces 1084A The Fair Nut and Elevator 题解

A. The Fair Nut and Elevatortime limit per test : 1 secondmemory limit per test : 256 megabytesinput : standard inputoutput : standard outputThe Fair Nut lives in

2018-12-30 12:02:28 231

原创 517的重要讲话(1)

一.如何对待不会做的题?1.题解2.学一下算法,再打。3.与同学交流。二.如何写题解?1.AC二十四小时以后,写题解的黄金时间。要把别人的题解给忘的差不多再写。2.AC四十八小时候,还做得出来,就基本上掌握了。...

2018-12-26 17:56:37 691

原创 Codeforces 158B Taxi 题解

题目链接:http://codeforces.com/problemset/problem/158/BDescriptionAfter the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that th...

2018-08-10 09:21:21 506

原创 Codeforces 1017B The Bits 题解

题目链接:http://codeforces.com/problemset/problem/1017/BDescriptionRudolf is on his way to the castle. Before getting into the castle, the security staff asked him a question: Given two binary numb...

2018-08-09 09:57:59 426 12

原创 Codeforces 1017A The Rank 题解

题目链接:http://codeforces.com/problemset/problem/1017/ADescriptionJohn Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of ...

2018-08-09 08:42:16 351

原创 HDU 1619 Unidirectional TSP 题解(求各路大佬解决问题)

英文DescriptionProblems that require minimum paths through some domain appear in many different areas of computer science. For example, one of the constraints in VLSI routing problems is minimizin...

2018-08-07 10:50:25 343

原创 Codeforces 1016A Death Note 题解

题目:点击链接即可:http://codeforces.com/problemset/problem/1016/A背景:You received a notebook which is called Death Note. This notebook has infinite number of pages. A rule is written on the last page (...

2018-08-07 08:27:10 341

原创 UVa 10935 Throwing cards away I 卡片游戏 题解

英文DescriptionGiven is an ordered deck of n cards numbered 1 to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at least two cards in ...

2018-07-25 19:06:31 341

原创 UVa 1225 Digit Counting 题解

英文DescriptionTrung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequence of consecutive integers starting with 1 to N (1 < N < 10000). After that, ...

2018-07-25 18:22:17 343

原创 C++并查集模板

说明:学习该模板比较推荐洛谷P3367 【模板】并查集,以下是该题链接及描述: https://www.luogu.org/problemnew/show/P3367题目描述如题,现在有一个并查集,你需要完成合并和查询操作。输入格式:第一行包含两个整数N、M,表示共有N个元素和M个操作。 接下来M行,每行包含三个整数Zi、Xi、Yi 当Zi=1时,将Xi与Yi所在的集...

2018-07-25 15:36:28 2175

原创 XJOI 3327 图的连通块的个数 题解

时间:1s 空间:32M题目描述:给你一副无向图,求连通块的个数 比如上图有3个连通块输入格式:第一行输入两个整数n,m,表示图的节点数量,边的数量 接下来输入m行,每行两个整数a,b表示a,b之间有一条无向边输出格式:输出一个整数样例输入:15 12 13 7 5 15 13 2 5 4 5 2 2 4 7 4 15 9 9 3 3...

2018-07-24 18:05:14 607

原创 UVa 1586 Molar mass 分子量 题解

英文DescriptionAn organic compound is any member of a large class of chemical compounds whose molecules contain carbon. The molar mass of an organic compound is the mass of one mole of the organic...

2018-07-23 13:06:42 593

原创 XJOI 3326 树的深度again 题解

时间:1s 空间:128M题目描述:给你一棵以1为根的树,求树的深度输入格式:第一行输入一个整数n,表示树的总点数 第二行输入n−1个数,第i个数表示i+1的父节点标号输出格式:输出一个整数表示树的深度(根节点的深度为1)样例输入:4 1 2 3样例输出:4约定:1<=n<=100000提示:此题是XJOI 332...

2018-07-23 10:39:54 554

原创 XJOI 3325 树的深度 题解

时间:0.5s 空间:128M题目描述:给你一棵以1为根的树,求树的深度,如下的树深为5 输入格式:第一行输入一个整数n,表示树的总点数 第二行输入n−1个数,第i个数表示i+1的父节点标号输出格式:输出一个整数表示树的深度(根节点的深度为1)样例输入:10 8 4 8 10 1 1 1 3 8样例输出:5约定:1<=...

2018-07-21 21:10:36 828

原创 UVa 1585 Score 得分 题解

英文DescriptionThere is an objective test result such as “OOXXOXXOOO”. An ‘O’ means a correct answer of a problem and an ‘X’ means a wrong answer. The score of each problem of this test is calcul...

2018-07-21 14:09:28 645

原创 UVa 1583 Digit Generator 生成元 题解

英文DescriptionFor a positive integer N, the digit-sum of N is defined as the sum of N itself and its digits. When M is the digitsum of N, we call N a generator of M. For example, the digit-sum ...

2018-07-21 13:42:49 273

原创 XJOI 3266 Dyeing 染色 题解

英文Time Limit:1s Memory Limit:256MDescriptionN grid in a line.Using three colour(red,pink and green) to dye the grid,each grid dyeing one colour,the rule is every two adjacent grid should b...

2018-07-16 11:10:25 409

原创 XJOI 3410 看图找规律 题解

英文Time Limit:0.5s Memory Limit:32MDescription The position of 8 is (2,3),please tell us the position of n. 1<=n<=10^15InputAn integer xOutputTwo integerSample Input18​S...

2018-07-14 15:24:16 587

原创 XJOI 1327 The union set 区间合并 题解

英文Time Limit:1s Memory Limit:256MDescriptionInput n interval,output the union set from small to large.InputThe first line contains an integer n. 1<=k<=100 The next n lines,each l...

2018-07-14 14:07:19 616 1

原创 XJOI 3287 离散化 题解

时间:1s 空间:128M题目描述:给你n个数,输出这n个数离散化后的结果 比如4 100 80 10000 离散化后为1 3 2 4 每个数的值为在原先数组中大小的排名,相同排名输出相同。 如1 1000 100 100 输出1 4 2 2输入格式:第一行输入一个整数n 第二行输入n个整数ai输出格式:输出一行,包含n个正整数样例输入:4...

2018-07-13 20:37:27 717 2

原创 XJOI 3585 The rescue plan 营救计划 题解

英文Time Limit:1s Memory Limit:256MDescriptionGiven a n*m map.A “Mengxin” is trapped.You are the one to rescue him.In the map,there are some guards,you must defeat the guards to get your way.D...

2018-07-13 15:41:46 1162

原创 XJOI 3330 Knight moving 骑士出行 题解

英文Time Limit:1s Memory Limit:256MDescription Please calculate the least steps knight moves from one position to another.InputThe first line is an integer n,represent a n*n chess board(x...

2018-07-13 15:04:26 715

原创 XJOI 3265 Climb the stairs 爬楼梯 题解

英文:Time Limit:0.2s Memory Limit:32MDescriptionEvery time you can climb one step or two steps,please calculate how many ways you can climb the final steps.InputOne integer n (The number of ...

2018-07-09 14:56:49 577

原创 XJOI 1210 二项式展开 题解

时间:1s 空间:256M题目描述:输出(a+b)^n的展开式输入格式:输入一行,包含一个整数n输出格式:见样例输出,注意空格的使用样例输入1:2样例输出1:(a+b)^2 = a^2 + 2*a*b + b^2样例输入2:3样例输出2:(a+b)^3 = a^3 + 3*a^2*b + 3*a*b^2 + b^3约定:0<...

2018-07-09 14:15:05 704

原创 XJOI 3281 A * B Problem again 题解

时间:1s 空间:128M题目描述:给你两个十进制数,数位最多有1000位,求他们的乘积输入格式:第一行输入一个整数 第二行输入一个整数输出格式:输出一个整数样例输入:12312312312142343254354354 4124354364565765456样例输出:5078033902248108457997596909050...

2018-07-09 11:23:47 580 1

原创 C++高精度乘法模板

方法还是与高精度加法的方法差不多,列一个竖式,就可以发现其中的规律了。#include <iostream>#include <cstdio>#include <string>#include <cstring>#include &lt

2018-07-09 11:15:08 6234 4

原创 XJOI 3280 A - B 题解

时间:1s 空间:128M题目描述:给你两个十进制数,数位最多有1000位,求他们的差输入格式:第一行输入一个整数 第二行输入一个整数输出格式:输出一个整数样例输入:12312312312142343254354354 4124354364565765456样例输出:12312308187787978688588898约定:A,B都是非负...

2018-07-09 09:42:47 758 1

原创 C++高精度减法模板

高精度减法要注意的是被减数必须必减数大,同时需要处理借位。方法类似于高精度加法。#include <iostream>#include <cstdio>#include <string>#include &am

2018-07-09 09:29:42 2254

原创 XJOI 1206 数组-合并有序数组 题解

时间:1s 空间:256M题目描述:给你两个有序的数组。合并这两个数组成为一个新的有序数组,并输出。输入格式:第一行输入两个整数n,m 第二行输入n个数,表示第一个有序数组 第三行输入m个数,表示第二个有序数组输出格式:输出n+m个数,表示两个数组合并之后的结果。样例输入:3 4 4 5 8 1 3 6 7样例输出:1 3 4 5 6 7 8...

2018-07-07 16:03:08 726

原创 C++快速幂模板

以下代码就可以算a^b%c的值,总的思路还是二分思想吧。要仔细体会一下(^_^)#include <cstdio>#include <iostream>#include <cmath&a

2018-07-07 13:09:41 1776

原创 建兰,我的程序人生的起点

今年,2018年。我从杭州市建兰中学毕业了。建兰中学应该在杭州乃至浙江省都是信息学奥林匹克竞赛的强校了。初一时,我通过了学校特意组织的数学考试,加入了建兰的信奥社团。三年来,我虽然没有取得重大的成绩,但建兰还是带给了我许多。首先,信奥社团给了我学习编程的兴趣,让我明白了计算机是如何处理一个个简单的任务。其次,社团中也让我结识了很多大神级的人物,大家互相交流学习,受益匪浅。最后,我也想对建兰中学表达...

2018-07-07 10:58:28 246 4

原创 XJOI 3404 刷油漆 题解

时间:1s 空间:128M题目描述:从1到n有n块砖需要刷油漆,砖的编号被a整除的要被刷成红色,被b整除的被刷成蓝色,同时被a,b整除的既可以被刷成红色,也可以被刷成蓝色。等你刷完后,对于每块红色的砖,老板会奖励给你p个巧克力,对于每块蓝色的砖,老板奖励q个巧克力,问你最多能得到多少巧克力输入格式:输入五个整数n,a,b,p,q输出格式:输出一个整数...

2018-07-07 10:42:31 742

原创 XJOI 3393 序列 题解

时间:1s 空间:128M题目描述:f(0)=0 f(2∗x)=f(x) f(2∗x+1)=f(x)+1 你有一个序列a1,a2,a3…an 现在你想知道有多少对的f(ai)=f(aj)(1<=i输入格式:第一行输入一个整数n 第二行输入n个整数ai输出格式:输出一个整数样例输入1:3 1 2 4样例输出1:3样例输入2...

2018-07-07 09:36:46 892

空空如也

空空如也

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

TA关注的人

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