- 博客(21)
- 收藏
- 关注
原创 HDU - 5925 D - Coconuts 二维数组的离散化问题
参考:https://www.cnblogs.com/stultus/p/6393444.html他的行和列是反着的..wa了无数次...学习使用了离散化这个知识点。这道题最大的难点就是离散化之后如何计算每个区间内的小格子数量,因为常规的离散化肯定会破坏小格子的数量的,所以我们需要记录一下啊。如果对于x方向进行离散化时, 1 2 5 7位置分别存在一个坏椰子。 那么我们离散化肯定离散成了 1...
2018-04-30 21:43:53 571
原创 HDU - 5927 F - Auxiliary Set
Given a rooted tree with n vertices, some of the vertices are important. An auxiliary set is a set containing vertices satisfying at least one of the two conditions: ∙∙It is an important vertex ∙∙It i...
2018-04-30 20:36:59 305
原创 URAL - 2070 Interesting Numbers
Nikolay and Asya investigate integers together in their spare time. Nikolay thinks an integer is interesting if it is a prime number. However, Asya thinks an integer is interesting if the amount of it...
2018-04-29 21:18:23 217
原创 可以来拯救吗 巧妙dfs 省时间
链接:https://www.nowcoder.com/acm/contest/117/E来源:牛客网题目描述 quailty is BNU's red sun. quailty非常喜欢给同学讲题,一天,他又拉着SK给他讲题。 quailty:给一个长为n的序列,求给定子序列的和,会吗? SK:。。 quailty:给一个长为n的序列,求给定子序列的和的平方,会吗? ...
2018-04-28 21:14:55 273
原创 Ivan comes again! set存放结构体
Problem DescriptionThe Fairy Ivan gave Saya three problems to solve (Problem F). After Saya finished the first problem (Problem H), here comes the second.This is the enhanced version of Problem H.Ther...
2018-04-27 21:00:07 232
原创 Mathmen 优先队列贪心
Problem DescriptionMathmen love mathematics, and they live on the number line. All the mathmen spend all their time on solving mathematical problems and proving theorems. Like humen beings, mathmen do...
2018-04-27 20:06:34 246
原创 sdut2414 An interesting game 费用流
建图题因为每个新添加的小山高度都在(0-30)之间,所以我们以这31个点,也就是高度作为点S-》S’容量为k,用来表明最多添加k个S'指向31个小山,容量为每个高度小山的个数。31个小山在指向n个大山。容量为1,费用比较麻烦。原本没有这个小山时,我们是abs(a[j]-a[j-1])。我们计算的是多余的,所以要把这一块减去,再加上加上小山后的值。也就是-(abs(i-a[j])+abs(i-a[j...
2018-04-25 21:30:28 250
原创 Fruit Ninja I 先暴力在DP
借鉴参考:http://www.mamicode.com/info-detail-1310283.html#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <stdio.h>using namespace std;int s[100...
2018-04-25 20:47:56 237
原创 SDUT 2605-A^X mod P题目描述 It's easy for ACMer to calculate A^X mod P. Now given seven integers n, A,
题目描述It's easy for ACMer to calculate A^X mod P. Now given seven integers n, A, K, a, b, m, P, and a function f(x) which defined as following.f(x) = K, x = 1f(x) = (a*f(x-1) + b)%m , x > 1Now, Your ...
2018-04-22 20:50:10 346
原创 Mountain Subsequences
Problem DescriptionCoco is a beautiful ACMer girl living in a very beautiful mountain. There are many trees and flowers on the mountain, and there are many animals and birds also. Coco like the mounta...
2018-04-22 19:46:55 334
原创 The number of steps 概率dp
Problem Description Mary stands in a strange maze, the maze looks like a triangle(the first layer have one room,the second layer have two rooms,the third layer have three rooms …). Now she stands a...
2018-04-21 20:05:57 269
原创 2016山东省第七届acm省赛 G题 Triple Nim
Submit Statistic Problem DescriptionAlice and Bob are always playing all kinds of Nim games and Alice always goes first. Here is the rule of Nim game: There are some distinct heaps of stones. On ea...
2018-04-15 20:46:49 241
原创 山东省第八届ACM大学生程序设计 fireworks
fireworksTime Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem DescriptionHmz likes to play fireworks, especially when they are put regularly.Now he puts some fireworks in a line. This ...
2018-04-12 21:44:24 242
原创 HDU6031 Innumerable Ancestors LCA
要求两个集合中两点最深的公共祖先。我们二分最深的深度,之后判断是否有两个集合的点在这个深度有公共祖先。对于当前深度mid,我们对于每一个a【i】,判断在mid出是否有点,有则加入set,没有不加。之后在枚举每一个b,判断b【i】在mid出的点是否在set中,如果在,说明当前b【i】与a中至少一点在mid深处有公共祖先。则返回true,再往更深的深度查询即可。#include<cstdio&g...
2018-04-10 20:46:24 261
原创 HDU - 6029 Graph Theory 规律题
Little Q loves playing with different kinds of graphs very much. One day he thought about an interesting category of graphs called ``Cool Graph'', which are generated in the following way: Let the set...
2018-04-08 17:46:42 450
原创 HDU - 6026 Deleting Edges
Little Q is crazy about graph theory, and now he creates a game about graphs and trees. There is a bi-directional graph with nn nodes, labeled from 0 to n−1n−1. Every edge has its length, which is a p...
2018-04-08 17:40:19 240
原创 hdu6029 Graph Theory
思维题;如果前面有2,那么我们当前1必须和前面那个2匹配。如果前面没有2了,那么我们这个1就当做2看,因为它没法和前面的链了,它属于被连的那个#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>using namespace std;int main(){ ...
2018-04-06 21:44:03 221
原创 hdu6024 Building Shops dp
HDU’s nn classrooms are on a line ,which can be considered as a number line. Each classroom has a coordinate. Now Little Q wants to build several candy shops in these nn classrooms. The total cost con...
2018-04-06 21:13:10 285
原创 hdu6025 Coprime Sequence 前缀后缀GCD
#include<stdio.h>#include<string.h>#include<iostream>using namespace std;int gcd(int a,int b){ if(b==0) return a; return gcd(b,a%b);}int qianzhuigcd[110000];int houzhuig...
2018-04-06 20:18:15 209
原创 CodeForces - 831C Jury Marks 思维题
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had som...
2018-04-03 19:18:30 267
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人