自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(88)
  • 收藏
  • 关注

原创 K-Nice ZOJ - 3212

This is a super simple problem. The description is simple, the solution is simple. If you believe so, just read it on. Or if you don't, just pretend that you can't see this one.We say an element is ...

2019-05-08 22:01:06 142

原创 Safecracker HDU - 1015 (搜索)

=== Op tech briefing, 2002/11/02 06:42 CST ==="The item is locked in a Klein safe behind a painting in the second-floor library. Klein safes are extremely rare; most of them, along with Klein and hi...

2019-05-06 19:51:11 158

原创 Lazier Salesgirl ZOJ - 3607

Kochiya Sanae is a lazy girl who makes and sells bread. She is an expert at bread making and selling. She can sell thei-th customer a piece of bread for pricepi. But she is so lazy that she will fal...

2019-05-03 21:41:48 174

原创 Draw Something Cheat ZOJ - 3603

Have you playedDraw Something? It's currently one of the hottest social drawing games on Apple iOS and Android Devices! In this game, you and your friend play in turn. You need to pick a word and dra...

2019-05-03 19:47:48 109

原创 Friends ZOJ - 3710

Alice lives in the country where people like to make friends. The friendship is bidirectional and if any two person have no less thankfriends in common, they will become friends in several days. Cur...

2019-05-02 22:33:20 132

原创 纯纯的暴力 Break Standard Weight ZOJ - 3706

Thebalancewas the first mass measuring instrument invented. In its traditional form, it consists of a pivoted horizontal lever of equal length arms, called the beam, with a weighing pan, also called...

2019-05-02 21:25:18 104

原创 Break Standard Weight ZOJ - 3706

The vast power system is the most complicated man-made system and the greatest engineering innovation in the 20th century. The following diagram shows a typical 14 bus power system. In real world, the...

2019-05-02 21:08:22 89

原创 Hard to Play ZOJ - 3712

MightyHorseis playing a music game calledosu!.After playing for several months,MightyHorsediscovered the way of calculating score inosu!:1. While playingosu!, player need to click some ...

2019-05-02 19:39:34 147

原创 Java Beans ZOJ - 3714

There areNlittle kids sitting in a circle, each of them are carrying some java beans in their hand. Their teacher want to selectMkids who seated inMconsecutive seats and collect java beans from ...

2019-05-02 18:58:33 126

原创 What day is that day? ZOJ - 3785

It's Saturday today, what day is it after 1^1+ 2^2+ 3^3+ ... +N^Ndays?InputThere are multiple test cases. The first line of input contains an integerTindicating the number of test cases. For...

2019-05-01 21:18:15 112

原创 Access System ZOJ - 3787

For security issues,Marjar Universityhas an access control system for each dormitory building.The system requires the students to use their personal identification cards to open the gate if they wan...

2019-05-01 20:49:39 107

原创 Mergeable Stack ZOJ - 4016

DescriptionGivennninitially empty stacks, there are three types of operations:1sv: Push the valuevvonto the top of thess-th stack.2s: Pop the topmost value out of thess-th stack, and pri...

2019-04-30 21:34:54 87

原创 King of Karaoke ZOJ - 4025

It's Karaoke time! DreamGrid is performing the song Powder Snow in the game King of Karaoke. The song performed by DreamGrid can be considered as an integer sequence , and the standard version of the ...

2019-04-29 21:59:22 182

原创 Peak ZOJ - 4024

看所给序列是否(严格)满足先递增,后递减。是输出“Yes”,不是输出“No”。#include<iostream>#include<cstring>#include<iostream>#include<cstring>#include<cstdio>#include<algorithm>#inclu...

2019-04-29 20:45:33 151

原创 C - POJ 1961 KMP

For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 ...

2019-04-28 22:15:23 86

原创 What Kind of Friends Are You?

Japari Park is a large zoo home to extant species, endangered species, extinct species, cryptids and some legendary creatures. Due to a mysterious substance known asSandstar, all the animals have bec...

2019-04-28 21:10:59 158

原创 Let's Chat

ACM (ACMers' Chatting Messenger) is a famous instant messaging software developed by Marjar Technology Company. To attract more users, Edward, the boss of Marjar Company, has recently added a new feat...

2019-04-28 12:42:23 435

原创 Mahjong Sorting ZOJ - 4034

DreamGrid has just found a set of Mahjong withsuited tiles and a White Dragon tile in his pocket. Each suited tile has a suit (Character, Bamboo or Dot) and a rank (ranging from 1 to), and there is...

2019-04-27 19:04:56 173

原创 B - POJ 2406 KMP

Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-...

2019-04-25 22:05:07 78

原创 A - HUD 2084 KMP

一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢?Input输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不再进行工作。Output...

2019-04-25 21:26:38 152

原创 R - POJ 2299 树状数组求逆序对

In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted i...

2019-04-25 09:51:18 132

原创 I - POJ 3468 分块

You haveNintegers,A1,A2, ... ,AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the ...

2019-04-22 21:04:18 174

原创 分块

长度为n的序列,把它分成根号n块,每一块的大小事根号n,每次更新的复杂度都是根号n。belong[maxn]//这个数在哪一块里面;block//表示每一块的大小;num//表示块数,即一共有多少块;l[maxn]//表示这个数所在块的左边界是什么;r[maxn]//表示这个数所在块的右边界是什么;void build(){ block = sqrt(n);//每块的大小...

2019-04-21 15:35:25 125

原创 训练

一、Counting Kangaroos is FunThere arenkangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hol...

2019-04-21 11:01:31 127

原创 N - HUD 3486 二分+RMQ

YaoYao has a company and he wants to employ m people recently. Since his company is so famous, there are n people coming for the interview. However, YaoYao is so busy that he has no time to interview ...

2019-04-20 17:02:35 148

原创 M - POJ 2019 二维RMQ

FJ has decided to grow his own corn hybrid in order to help the cows make the best possible milk. To that end, he's looking to build the cornfield on the flattest piece of land he can find.FJ has, a...

2019-04-20 11:00:10 206

原创 二维RMQ

二维RMQ两种做法:1) O(n*m*log(m))-O(n)2) O(n*m*log(n)*log(m)-O(1)第一种方法:把每一行都当成一维RMQ处理代码:#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#incl...

2019-04-19 22:22:25 1223 1

原创 K - POJ 3368 RMQ

You are given a sequence ofnintegersa1, a2, ... , anin non-decreasing order. In addition to that, you are given several queries consisting of indicesiandj(1 ≤ i ≤ j ≤ n). For each query, det...

2019-04-18 16:31:50 128

原创 广搜(bfs)——Catch the cow

import java.util.Arrays;import java.util.LinkedList;import java.util.Queue;import java.util.Scanner;public class Main { final static public int maxn=100005; public static int []vis=new int [m...

2019-04-17 21:32:07 138

原创 并查集 - Ubiquitous Religions

题意:想知道学校的学生信仰多少种不同的宗教。学校有n个学生(0<n <= 50000)。问m (0<=m <=n(n-1)/2)对学生,问他们是否信仰相同的宗教。了解校园里可能代表多少种不同宗教的上限。每个学生最多只信奉一种宗教。input输入由许多情况组成。n(学生数)、m(相同的对数)。接下来的m行 i 同学和 j 同学信仰相同。output输出 ...

2019-04-17 21:31:44 69

原创 关于全排列- dfs与STL

给出一个字符串S(可能有重复的字符),按照字典序从小到大,输出S包括的字符组成的所有排列。例如:S = "1312",输出为:112311321213123113121321211321312311311231213211Input输入一个字符串S(S的长度 <= 9,且只包括0 - 9的阿拉伯数字)Output输出S...

2019-04-17 21:31:36 87

转载 字典树

字典树的性质:(1)字典树的根节点不包含字符,除根节点外,每个节点都只包含一个字符。(2)从根节点到某一结点,路径上经过的所有字符连接起来,为某一结点的字符串。(3)每个结点包含的所有子结点字符都不相同。(4)字典树牺牲空间换取时间。当数据量很大时,会占用很大空间。如果字符串均有小写字母组成,则每个结点最多会有26个儿子结点,最多会有26n个用于存储的结点,n为字符串的最大长度。...

2019-04-17 21:29:29 88

原创 训练

一、A - Round HouseVasya lives in a round building, whose entrances are numbered sequentially by integers from1ton. Entrancenand entrance1are adjacent.Today Vasya got bored and decided to ...

2019-04-16 22:35:49 142

原创 J - POJ 2364 RMQ

For the daily milking, Farmer John'sNcows (1 ≤N≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things ...

2019-04-16 17:31:48 111

原创 D - POJ 3349 Hash

You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read information about a collection of snowflakes, and...

2019-04-15 20:58:17 104

原创 RMQ算法

我们先用一个例题来描述一下,RMQ所解决的问题类型例:南将军统帅着N个士兵,士兵编号分别为1~N,南将军经常爱拿某一段编号内杀敌数最高的人与杀敌数最低的人进行比较,计算两个人的杀敌数差值,用这种方法一方面能鼓舞杀敌数高的人,另一方面也算是批评杀敌数低的人,起到了很好的效果。所以,南将军经常问军师小工第i号士兵到第J号士兵中,杀敌数最高的人与杀敌数最低的人之间的军工差值是多少。现在请你写一个...

2019-04-15 20:51:24 142

原创 Q - POJ 1195 树状数组(二维树状数组,点修改,区间查询)

Suppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an S * S matrix with the rows and columns numbe...

2019-04-12 19:53:43 210

原创 树状数组【二维】

二维树状数组和一维树状数组的原理一样;首先,一维树状数组的储存结构为:C1 = A1C2 = A1 + A2C3 = A3C4 = A1 + A2 + A3 + A4C5 = A5C6 = A5 + A6C7 = A7C8 = A1 + A2 + A3 + A4 + A5 + A6 + A7 + A8……C16 = A1 + A2 + A3 + A4 + A5 + A...

2019-04-12 15:13:08 195

原创 P - POJ 2481 树状数组

Farmer John's cows have discovered that the clover growing along the ridge of the hill (which we can think of as a one-dimensional number line) in his field is particularly good.Farmer John has N co...

2019-04-11 21:08:07 66

原创 O - POJ 2352树状数组

Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and ...

2019-04-10 21:51:45 105

空空如也

空空如也

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

TA关注的人

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