
ZOJ
文章平均质量分 73
Mr_Treeeee
这个作者很懒,什么都没留下…
展开
-
2017 CCPC 秦皇岛 & ZOJ 3981 - Balloon Robot 规律
Balloon RobotTime Limit: 1 Second Memory Limit: 65536 KBThe 2017 China Collegiate Programming Contest Qinhuangdao Site is coming! There will be teams participating in the contest, an原创 2017-12-19 23:14:42 · 562 阅读 · 0 评论 -
ZOJ 3469 - Food Delivery (区间DP)
Food DeliveryTime Limit: 2 Seconds Memory Limit: 65536 KBWhen we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At this time, we m...原创 2018-05-01 13:50:46 · 250 阅读 · 0 评论 -
ZOJ 4029 - Now Loading!!! (数论 规律)
题目由于n,m比较大,说明时间复杂度最多再乘以log。这里由于log(a[i])最大只有30,那么我们考虑去预处理出a[i]/k的前缀和(k为分母)然后每次对一个读入的p,令分母确定为tmp,那么a[i]的范围应该是[pow(p,tmp-1)+1,pow(p,tmp)],利用二分找出两个位置,然后用一下前缀和即可。#include <iostream>#include <std...原创 2018-05-06 20:39:33 · 394 阅读 · 0 评论 -
ZOJ Monthly, June 2018 - I District Division
点击打开链接题意:把有n个节点的一棵树分成n/k棵树。保证b%k=0。输出每棵树的节点序号。否则输出NO。POINT:输出序号可以借助stack。对于每个根节点,看每条子树还有多少节点。因为每个子树要形成一个树(假设他们合起来为个数为k),必须要用到根节点。所以对于每个子树的节点加起来,在加上1(根节点)。如果大于k,就NO了。要正好等于k,才符合题意。若小于k,那么回溯往前面合并。#includ...原创 2018-07-09 19:25:27 · 280 阅读 · 0 评论 -
ZOJ Monthly, June 2018 - E Chasing (三分)
点击打开链接 题意:有A点和B点,都x<0,此时A点要跑到x>0的范围。给你B、A两点的速度之比。B在追赶A,问你A能不能逃离。 POINT:首先想到枚举A点逃离的位置,即Y轴上的所有点。然后算出A点和B点到这个点的距离之比。在和速度之比相比较。就可以知道是否追上。但是实数点是不能枚举的。列出式子可知。仅讨论B在A点左边的情况:dis(...原创 2018-07-09 19:33:25 · 290 阅读 · 0 评论 -
ZOJ Monthly, June 2018 - J Good Permutation
点击打开链接题意:给你一个数列。问你交换成特殊逆序对所需要的次数。特殊逆序对:1 2 3 4 5、5 1 2 3 4、4 5 1 2 3、3 4 5 1 2 ……POINT:先算出1 2 3 4 5 正常的逆序对所需要的次数。然后for循环更新。#include <iostream>#include <stdio.h>using namespace std;const...原创 2018-07-09 19:35:34 · 353 阅读 · 0 评论 -
ZOJ - 3752 The Three Guys
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3752题意:给你3个人的上半身和下半身的长度。问你组合后能形成的最大面积的三角形是多大。一个人的上半身和下半身当然可以任意形成角度,但是不能分开。合理 point:排列组合然后判断一个人有没有被分开。合理的话就可以算一次面积了。注意排列组合如果...原创 2018-09-23 10:29:35 · 166 阅读 · 0 评论 -
ZOJ 3751 - Diagonal (构造)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5174题意:给你n*n的空矩阵,让你从1到n*n这些数,按顺序在矩阵从填上。你可以任意选择起点,然后上下左右走,1 2 3的填。让你构造出主对角线和最大。输出和。 POINT:从(2,2)开始构造,到(3,3)-(4,4)--(n,n) 然后跑...原创 2018-09-27 22:12:26 · 271 阅读 · 0 评论 -
ZOJ 3755 - Mines (状压DP)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5178题意:大家都玩过扫雷吧。给你n*m的扫雷数字。数字都在偶数列上。也就是说,棋盘是n*(2*m+1)大小。让你输出最少的雷数。 POINT:n最大是10,暗示我们状压DP。挺简单的,不阐述了。#include <stdio.h&...原创 2018-09-27 22:15:58 · 291 阅读 · 0 评论 -
ZOJ 3537 - Cake (凸包+区间DP)
CakeTime Limit: 1 Second Memory Limit: 32768 KBYou want to hold a party. Here's a polygon-shaped cake on the table. You'd like to cut the cake into several triangle-shaped parts for the invited c...原创 2018-05-01 13:29:22 · 319 阅读 · 0 评论 -
ZOJ 3802 - Easy 2048 Again (状态压缩DP+滚动数组)
Easy 2048 AgainTime Limit: 2 Seconds Memory Limit: 65536 KBDark_sun knows that on a single-track road (which means once he passed this area, he cannot come back again), there are some underground...原创 2018-04-18 10:02:46 · 205 阅读 · 0 评论 -
ZOJ Monthly, January 2018 - J Distance
题意:找出有几个数量相等的连续的区间对。 区间里的相对距离POINT:n^2的效率遍历上下数组的开头。然后每次扫一遍就有答案。因为区间要连续的。每次都是右边加进来。左边删掉最优。注意不要重复。#include #include #include #include #include using namespace std;typedef long lo原创 2018-01-25 18:09:01 · 442 阅读 · 0 评论 -
2017 CCPC 秦皇岛 & ZOJ 3983 - Crusaders Quest
Crusaders QuestTime Limit: 1 Second Memory Limit: 65536 KBCrusaders Quest is an interesting mobile game. A mysterious witch has brought great darkness to the game world, and the only ho原创 2017-12-19 23:21:13 · 449 阅读 · 0 评论 -
2017 CCPC 秦皇岛 & ZOJ 3985 - String of CCPC (子串)
String of CCPCTime Limit: 1 Second Memory Limit: 65536 KBBaoBao has just found a string of length consisting of 'C' and 'P' in his pocket. As a big fan of the China Collegiate Pro原创 2017-12-19 23:23:57 · 318 阅读 · 0 评论 -
2017 CCPC 秦皇岛 & ZOJ 3987 - Numbers (贪心+大数)
NumbersTime Limit: 2 Seconds Memory Limit: 65536 KBDreamGrid has a nonnegative integer . He would like to divide into nonnegative integers and minimizes their bitwise or (i.e. an原创 2017-12-19 23:26:44 · 472 阅读 · 0 评论 -
2017 CCPC 秦皇岛 & ZOJ 3993 - Safest Buildings (概率+规律)
Safest BuildingsTime Limit: 1 Second Memory Limit: 65536 KBPUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and sca原创 2017-12-19 23:29:49 · 382 阅读 · 0 评论 -
ZOJ Monthly, January 2018 - B PreSuffix (字典树)
Sample Input3abcbde21 22 37xabcdyabcdcdocdpcdqcdrabcdz11 23aaaaaa11 3Sample OutputNN13题意:给你n个字符串。每次询问给你x,y代表找出第x和y对字符串的【最长】相同后缀。然后如果这n个字符串的前缀是这个后缀的话,就num++原创 2018-01-25 17:46:37 · 422 阅读 · 0 评论 -
ZOJ Monthly, January 2018 - D Seat Assignment (最大流)
HintThe first sample:There are 10 seats numbered from 1 to 10.There are 2 people wanting their seat number to be a multiple of 1, 1 person wanting his seat number to be a multiple of 2, and 4原创 2018-01-25 17:54:25 · 585 阅读 · 0 评论 -
ZOJ Monthly, January 2018 - E Yet Another Data Structure Problem
题意:线段树的乘和次方操作。POINT:学习一下lazy数组的更新就行了。 类似区间加和乘操作。 bozj 1798mul和fang数组代表,下面的区间要^fang 然后乘mul。mul操作就在mul数组正常更新。fang操作就要把mul数组也更新掉。 mul=mul^fang。#include #include原创 2018-01-25 18:00:58 · 607 阅读 · 0 评论 -
ZOJ Monthly, January 2018 - F The Limit
题意:求分数的极限。POINT:简单的多项式处理掉。然后0/0的时候洛必达上下求导继续。1/0 输出inf。注意分母为1的时候。#include #include #include #include #include #include using namespace std;#define LL long longconst LL maxn =原创 2018-01-25 18:05:03 · 385 阅读 · 0 评论 -
ZOJ 3753 - Simple Equation (数论)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3753题意:给你A,B,M.找出满足AX + BY = XY的X,Y。条件X>=M,在X+Y最小的前提下 X最小。 POINT:变形得 (X-B)*(Y-A)=A*BAB已知,求x+y最小,就是求x-b+y-a最小。x-b和y-a明显是a...原创 2018-09-27 22:21:05 · 235 阅读 · 0 评论