自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

howell

贵有恒,何必三更起五更眠;最无益,莫过一日曝十日寒。

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

原创 Gym 101606B Breaking Biscuits [ 计算几何 ]

题意:给定一个规则多边形,求一个最小的圆,能包含整个多边形,求这个圆的直径。。。思路:就是直接枚举每一条直线,求这条直线的两边的点到直线的最大距离即可。。。代码:#include<bits/stdc++.h>#include<algorithm>using namespace std;const int N=111;struct P{ int x,y; ...

2018-04-30 21:30:16 395

原创 Gym 101606F Flipping Coins [ 递推 DP ]

题意:有n个硬币,排成一排,抛k次,一开始都是反面朝上,问正面朝上硬币的期望。思路:全程懵逼啊。。。。。----------------------------------------------------------------------------------------------------------------------随机变量X是指正面朝上的硬币的个数, 概率为p(X); X ...

2018-04-30 20:20:18 144

原创 Gym 101606D Deranging Hat [选择排序逆输出]

题意:给定一个字符串,要求把他先以字符串升序排列,在以题目中定义的排序方式排回来,分明是个选择排序嘛。。。代码:#include<bits/stdc++.h>#include<iostream>#include<cstring>#include<cstdio>#include<stack>using namespace std;...

2018-04-30 18:09:08 256

原创 Gym 101606A Alien Sunset [贪心+暴力]

题意:题目很简单,就是说现在想找一个最早的时间,所有星球都在晚上,现在已经知道各个星球的自转周期,并且知道他们各自日出日落时间。。。思路:一共100*1850天,那样我直接枚举,找到第一个n个都是夜晚的天就可以了。。代码:#include<bits/stdc++.h>#include<algorithm>#define ll long longusing names...

2018-04-30 17:43:34 573

原创 Codeforces 967 A. Mind the Gap [思维]

A. Mind the Gaptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThese days Arkady works as an air traffic controller at a large airport. He controls...

2018-04-30 17:03:01 337

原创 Codeforces DP 练习

Codeforces 466 C. Number of Ways【前缀】C. Number of Waystime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou've got array a[1], a[2], ..., a[n], consi...

2018-04-29 13:01:28 576

原创 牛客练习赛16 E 求值

 E求值题目描述 给定n个数字a1, a2, ..., an。定义f(l, r) = al | al+1| ... | ar。现在枚举(1 <= l <= r <= n),问不同的f值一共有多少个。输入描述:第一行一个整数n表示数组大小 (1 <= n <= 100,000);第二行n个整数满足0 <= ai <= 1000,000。输出描述:输出一个...

2018-04-29 00:42:47 364 7

原创 Codeforces 732 B. Cormen — The Best Friend Of a Man [ 贪心 ]

B. Cormen — The Best Friend Of a Mantime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently a dog was bought for Polycarp. The dog's name is Corme...

2018-04-29 00:07:37 134

原创 Codeforces 550 A. Two Substrings

A. Two Substringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given string s. Your task is to determine if the given string s contains ...

2018-04-28 23:19:02 187

原创 Codeforces 327A. Flipping Game[ 最大子序列的和 ]

A. Flipping Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIahub got bored, so he invented a game to be played on paper.He writes n integers a...

2018-04-28 18:57:52 427

原创 Codeforces 489 C. Given Length and Sum of Digits...[ 贪心 ]

C. Given Length and Sum of Digits...time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a positive integer m and a non-negative integer s. You...

2018-04-28 16:51:15 180 2

原创 Codeforces 189 A. Cut Ribbon(DP 恰装满的完全背包问题)

A. Cut Ribbontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarpus has a ribbon, its length is n. He wants to cut the ribbon in a way that ful...

2018-04-28 13:58:24 299

原创 Codeforces 455A. Boredom [ 简单DP ]

A. Boredomtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One...

2018-04-28 13:17:56 307

原创 codeforces 962 E. Byteland, Berland and Disputed Cities

E. Byteland, Berland and Disputed Citiestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe cities of Byteland and Berland are located on the axis...

2018-04-28 10:14:15 267

原创 牛客练习赛16 F - 选值

F选值题目描述 给定n个数,从中选出三个数,使得最大的那个减最小的那个的值小于等于d,问有多少种选法。输入描述:第一行两个整数n,d(1 <= n <= 100,000,1 <= d <= 1000,000,000);第二行n个整数满足abs(ai) <= 1,000,000,000。数据保证a单调递增。输出描述:输出一个整数表示满足条件的选法。示例1输入4 3...

2018-04-28 09:39:45 327

原创 牛客练习赛16 C - 任意点

C任意点题目描述 平面上有若干个点,从每个点出发,你可以往东南西北任意方向走,直到碰到另一个点,然后才可以改变方向。请问至少需要加多少个点,使得点对之间互相可以到达。输入描述:第一行一个整数n表示点数( 1 <= n <= 100)。第二行n行,每行两个整数xi, yi表示坐标( 1 <= xi, yi <= 1000)。y轴正方向为北,x轴正方形为东。输出描述:输出一...

2018-04-28 09:33:54 380

原创 牛客练习赛16 B - 漂亮的树

B漂亮的树题目描述街上有n棵树,标号为1...n,第i棵树的高度为ai。 定义这n棵树是漂亮的,当且仅当     1. 对于所有的i,ai=an-i+1;     2. 对于1 <= i < n / 2 (不是整除),ai + 1= ai + 1; 比如说 “2 3 4 5 5 4 3 2”和“1 2 3 2 1”是漂亮的而“1 3 3 1”和“1 2 3 1”不是。 现在请问最少修改...

2018-04-28 09:31:01 218

原创 牛客练习赛16 A - 字典序最大的子序列

A字典序最大的子序列题目描述给定字符串s,s只包含小写字母,请求出字典序最大的子序列。 子序列:https://en.wikipedia.org/wiki/Subsequence 字典序:https://en.wikipedia.org/wiki/Lexicographical_order输入描述:一行一个字符串s (1 <= |s| <= 100,000)。输出描述:字典序最大的子序...

2018-04-28 09:27:51 413

原创 HDU 6024 Building Shops( DP )

Building ShopsTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2304    Accepted Submission(s): 797Problem DescriptionHDU’s n classrooms are on ...

2018-04-27 16:02:11 110

原创 D.Triple Nim(打表+找规律)

Triple NimTime Limit: 2000 ms Memory Limit: 65536 KiBSubmit StatisticProblem DescriptionAlice and Bob are always playing all kinds of Nim games and Alice always goes first. Here is the rule of Nim gam...

2018-04-27 15:53:18 260

原创 codeforces 962 D. Merge Equals

D. Merge Equalstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of positive integers. While there are at least two equal ele...

2018-04-26 20:15:47 177

原创 codeforces 962 C. Make a Square

C. Make a Squaretime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a positive integer nn, written without leading zeroes (for example, ...

2018-04-25 22:23:14 143

原创 codeforces 962 B. Students in Railway Carriage

B. Students in Railway Carriagetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are nn consecutive seat places in a railway carriage. Each pl...

2018-04-25 22:20:47 155

原创 codeforces 962 A. Equator

A. Equatortime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp has created his own training plan to prepare for the programming contests. He w...

2018-04-25 22:18:42 149

原创 BST(树状数组原理)

BSTTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10615 Accepted: 6497DescriptionConsider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, ....

2018-04-24 22:11:54 604

原创 POJ 2155 Matrix(树状数组)

MatrixTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 31309 Accepted: 11411DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-...

2018-04-24 21:43:24 160 2

原创 Color the ball(差分数组+树状数组维护)

Color the ballTime Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 25532    Accepted Submission(s): 12406Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3.....

2018-04-24 20:27:42 465

原创 Wannafly挑战赛14 A 直角三棱锥

题目描述 在三维空间中,平面 x = 0, y = 0, z = 0,以及平面 x + y + z = K 围成了一个三棱锥。整天与整数打交道的小明希望知道这个三棱锥内、上整点的数目。他觉得数量可能很多,所以答案需要对给定的 M 取模。输入描述:输入有 1 ≤ T ≤ 105 组数据。每组数据中,输入两个整数 0 ≤ K ≤ 109 + 7, 1 ≤ M ≤ 109 + 7,意义如题目描述。输...

2018-04-22 17:23:08 317 5

原创 Wannafly挑战赛14 B 前缀查询(字典树 + 0.5dfs)

题目描述 在一个 Minecraft 村庄中,村长有这一本小写字母构成的名册(字符串的表),每个名字旁边都记录着这位村民的声望值,而且有的村民还和别人同名。随着时间的推移,因为没有村民死亡,这个名册变得十分大。现在需要您来帮忙维护这个名册,支持下列 4 种操作:1. 插入新人名 si,声望为 ai2. 给定名字前缀 pi 的所有人的声望值变化 di3. 查询名字为 sj 村民们的声望值的和(因为会...

2018-04-22 17:09:10 245

原创 [EOJ Monthly 2018.4] E. 小迷妹在哪儿

E. 小迷妹在哪儿Time limit per test: 2.0 secondsMemory limit: 256 megabytesultmaster 男神和小迷妹们玩起了捉迷藏的游戏。小迷妹们都希望自己被 ultmaster 男神发现,因此她们都把自己位置告诉了 ultmaster 男神,因此 ultmaster 男神知道了自己去找每个小迷妹所要花的时间。已知发现第 i 小迷妹得到的分数为 ...

2018-04-21 22:31:58 585 1

原创 [EOJ Monthly 2018.4] A. ultmaster 的小迷妹们

A. ultmaster 的小迷妹们Time limit per test: 2.0 secondsMemory limit: 256 megabytesultmaster 男神和他的小迷妹们准备躺在图书馆前大草坪享受惬意的午后。有强迫症的 ultmaster 想要使得自己和小迷妹们正好躺成一块完整的正方形,ultmaster 想知道能否挑出一些小迷妹(至少一个)实现他的愿望。已知 ultmast...

2018-04-21 22:16:47 665

原创 [EOJ Monthly 2018.4] B. 代码查重

B. 代码查重Time limit per test: 2.0 secondsMemory limit: 256 megabytes一场 EOJ 月赛中在小迷妹们的合作之下她们 AC 了所有题目。拥有 EOJ 管理员权限的 ultmaster 男神理所当然地抄袭了小迷妹们的代码,并修改了部分代码。ultmaster 男神想知道他的代码是否会被查重,若会被查重则输出 Yes 否则输出 No。由于 E...

2018-04-21 22:03:24 2304

原创 FZU 2280 Magic(字典树+树状数组维护)

 Problem 2280 MagicAccept: 126    Submit: 430Time Limit: 2000 mSec    Memory Limit : 262144 KB Problem DescriptionKim is a magician, he can use n kinds of magic, number from 1 to n. We use string Si t...

2018-04-21 18:47:16 272

原创 CODEVS 4189 字典(Trie树)

4189 字典 时间限制: 1 s 空间限制: 256000 KB 题目等级 : 大师 Master题解题目描述 Description最经,skyzhong得到了一本好厉害的字典,这个字典里整整有n个单词(1<=n<=200000)现在skyzhong需要在字典里查询以某一段字母开头的单词如:skyzhong想查询a那么只要是a开头的单词就可以了skyzhong只想知道里面有没有这一...

2018-04-21 10:34:04 155

原创 HDU 1251 统计难题(Trie树)

统计难题Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 50151    Accepted Submission(s): 17704Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组...

2018-04-21 10:21:56 155

原创 Trie树(字典树)学习

一、引入字典是用来干啥的?       查找字的;字典树自然也是起查找作用。我们也许会遇到这样子的问题:        给出n个单词和m个询问,每次询问一个单词,回答这个单词是否在单词表中出现过;         答案:很容易想到用map, 快速解题。。。。那么当我们再次遇到这样的呢?        给出n个单词和m个询问,每次询问一个前缀,回答这个前缀是多少单词的前缀;        这样我们用...

2018-04-21 09:49:06 171

原创 codeforces 964B Messages

B. Messagestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n incoming messages for Vasya. The i-th message is going to be received after ...

2018-04-20 18:00:43 393

原创 Java大数类用法了解

在Java中有两个类BigInteger和BigDecimal分别表示大整数类和大浮点数类;至于两个类的对象能表示最大范围不清楚,理论上能够表示无线大的数,只要计算机内存足够大。 这两个类都在java.math.*包中,因此每次必须在开头处引用该包。Ⅰ基本函数: 1.valueOf(parament); 将参数转换为指定的类型 比如 int a = 3; BigInteger b = BigInt...

2018-04-20 17:23:12 897

原创 Problem 2281 Trades

 Problem 2281 TradesAccept: 114    Submit: 612Time Limit: 1000 mSec    Memory Limit : 262144 KB Problem DescriptionThis is a very easy problem.ACMeow loves GTX1920. Now he has m RMB, but no GTX1920s. ...

2018-04-20 16:25:40 264

原创 HDU 1686 Oulipo

OulipoTime Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18518    Accepted Submission(s): 7274Problem DescriptionThe French author Georges Perec (1...

2018-04-19 14:30:54 85

空空如也

空空如也

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

TA关注的人

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