自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 前缀和简介及模板

原文章:https://blog.csdn.net/shinian_acmer/article/details/89742912前缀和是一种预处理,可以降低时间复杂度,可以在后面的计算中可以直接应用前面已经算出的结果。一维前缀和模板题:给出一个长度为N的数组,进行Q次查询,查询从第i个元素开始长度为l的子段所有元素之和。例如,1 3 7 9 -1,查询第2个元素开始长度为3的子...

2019-08-30 23:25:27 133

原创 (kuangbin带你飞--区间DP)Coloring Brackets

原题目:Once Petya read a problem about a bracket sequence. He gave it much thought but didn't find a solution. Today you will face it.You are given string s. It represents a correct bracket sequence....

2019-08-28 14:23:09 135

原创 (kuangbin带你飞--计算几何)Pick-up sticks

原题目:Stan has n sticks of various length. He throws them one at a time on the floor in a random way. After finishing throwing, Stan tries to find the top sticks, that is these sticks such that there ...

2019-08-23 10:31:09 113

原创 (kuangbin带你飞--线段树)A Simple Problem with Integers

原题目:You have N integers, 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 fo...

2019-08-22 18:46:56 84

原创 线段树模板

线段树定义:struct node{ int l/*区间左边界*/,r/*区间右边界*/,sum/*区间元素之和*/,lazy/*懒惰标记,下文会提到*/; node(){l=r=sum=lazy=0;}//给每一个元素赋初值}a[N];//N为总节点数inline void update(int k)//更新节点k的sum{ a[k].sum=a[k*2].sum+a[k*2...

2019-08-21 18:20:02 68

原创 (kuangbin带你飞--线段树)I Hate It

原题目:很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=200000,0<M&l...

2019-08-21 14:16:37 112

原创 (kuangbin带你飞--线段树)敌兵布阵 (线段树模板)

原题目:C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什...

2019-08-21 11:11:42 147

原创 (CCF认证)201903-2 二十四点

#include<iostream>using namespace std;bool ismd(char op){ return (op == '/' || op == 'x' ? true : false);}int op(char op, int num1, int num2){ switch (op) { case '+': ...

2019-08-19 13:57:51 123

原创 (CCF认证)201903-1 小中大

满分代码:#include<iostream>#include<bits/stdc++.h>#include<math.h>#define Eps 1e-6using namespace std;int main(){ double a[100005]; int t; scanf("%d",&t); for(int...

2019-08-19 12:25:57 89

原创 判断一个double类型数是否是整数方法

两种方法第一个:const double EPS 1e-6;...double a;...if(a - (double)((int)a) < EPS)//则为整数另一个:#include <math.h>...const double EPS 1e-6double a;...if(a - floor(a) < EPS)//则为...

2019-08-19 12:21:52 6388 2

原创 Crazy Calendar (尼姆博弈)

原题目:2011 was a crazy year. Many people all over the world proposed on 11-11-11, married on 11-11-11, some even went through surgery only to have 11-11-11 as their child's birth date. How crazy peopl...

2019-08-19 11:01:16 161

原创 Sprague-Grundy函数简介(SG函数)

原文章:https://blog.csdn.net/strangedbly/article/details/51137432现在我们来研究一个看上去似乎更为一般的游戏:给定一个有向无环图和一个起始顶点上的一枚棋子,两名选手交替的将这枚棋子沿有向边进行移动,无法移动者判负。事实上,这个游戏可以认为是所有Impartial Combinatorial Games的抽象模型。也就是说,任何一个ICG...

2019-08-18 22:42:15 594

原创 Partitioning Game (SG函数)

原题目:Alice and Bob are playing a strange game. The rules of the game are:Initially there are n piles. A pile is formed by some cells. Alice starts the game and they alternate turns. In each t...

2019-08-18 22:36:19 100

原创 尼姆博弈简介与内容

原文章:https://blog.csdn.net/strangedbly/article/details/51137432重点结论:对于一个Nim游戏的局面(a1,a2,...,an),它是P-position当且仅当a1^a2^...^an=0,其中^表示位异或(xor)运算。Nim游戏是博弈论中最经典的模型(之一?),它又有着十分简单的规则和无比优美的结论,由这个游戏开始了解博弈论恐怕...

2019-08-18 22:18:34 189

原创 Incredible Chess(尼姆博弈)

原题目:You are given an n x n chess board. Only pawn is used in the 'Incredible Chess' and they can move forward or backward. In each column there are two pawns, one white and one black. White pawns ar...

2019-08-17 22:59:21 129

原创 Be the Winner (反尼姆博弈)

原题目:Let's consider m apples divided into n groups. Each group contains no more than 100 apples, arranged in a line. You can take any number of consecutive apples at one time.For example "@@@" can b...

2019-08-17 17:31:29 144

原创 Left Right (尼姆博弈)

原题目:Two players, Alice and Bob are playing a strange game in a 1 x n board. The cells are numbered from 0 to n-1, where the left most cell is marked as cell 0. Each cell can contain at most one piec...

2019-08-17 17:12:34 176

原创 Matrix Game(尼姆博弈)

原题目:Given an m x n matrix, where m denotes the number of rows and n denotes the number of columns and in each cell a pile of stones is given. For example, let there be a 2 x 3 matrix, and the piles ...

2019-08-16 20:37:02 249

原创 Being a Good Boy in Spring Festival (尼姆博弈)

原题目:一年在外 父母时刻牵挂春节回家 你能做几天好孩子吗寒假里尝试做做下面的事情吧陪妈妈逛一次菜场悄悄给爸爸买个小礼物主动地 强烈地 要求洗一次碗某一天早起 给爸妈用心地做回早餐如果愿意 你还可以和爸妈说咱们玩个小游戏吧 ACM课上学的呢~下面是一个二人小游戏:桌子上有M堆扑克牌;每堆牌的数量分别为Ni(i=1…M);两人轮流进行;每走一步可以任意选择一堆并取走其中的任意张...

2019-08-16 20:00:40 170

原创 Misere Nim (反尼姆博弈)

原题目:Alice and Bob are playing game of Misère Nim. Misère Nim is a game playing on k piles of stones, each pile containing one or more stones. The players alternate turns and in each turn a player ca...

2019-08-16 19:36:10 430

原创 Kejin Player (概率DP)hdu6656

原题目:Cuber QQ always envies those Kejin players, who pay a lot of RMB to get a higher level in the game. So he worked so hard that you are now the game designer of this game. He decided to annoy thes...

2019-08-16 17:52:30 154

原创 斐波那契博弈简介

原文章: https://blog.csdn.net/dgq8211/article/details/7602807 有一堆个数为n(n>=2)的石子,游戏双方轮流取石子,规则如下:1)先手不能在第一次把所有的石子取完,至少取1颗;2)之后每次可以取的石子数至少为1,至...

2019-08-16 15:25:29 144

原创 取石子游戏 hdu2516(斐波那契博弈)

原题目:1堆石子有n个,两人轮流取.先取者第1次可以取任意多个,但不能全部取完.以后每次取的石子数不能超过上次取子数的2倍。取完者胜.先取者负输出"Second win".先取者胜输出"First win".Input输入有多组.每组第1行是2<=n<2^31. n=0退出.Output先取者负输出"Second win". 先取者胜输出"First win".参...

2019-08-16 15:24:00 149

原创 Birthday Paradox (概率论)

原题目:Sometimes some mathematical results are hard to believe. One of the common problems is the birthday paradox. Suppose you are in a party where there are 23 people including you. What is the proba...

2019-08-16 12:09:20 212

原创 Race to 1 Again(概率DP)

原题目:Rimi learned a new thing about integers, which is - any positive integer greater than 1 can be divided by its divisors. So, he is now playing with this property. He selects a number N. And he ca...

2019-08-16 11:04:47 129

原创 Just another Robbery (概率+01背包)

原题目:As Harry Potter series is over, Harry has no job. Since he wants to make quick money, (he wants everything quick!) so he decided to rob banks. He wants to make a calculated risk, and grab as muc...

2019-08-16 09:39:08 103

原创 Discovering Gold (概率DP)

部分摘自:https://www.cnblogs.com/daydayupacm/p/5788115.html原题目:You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amount of gold.Initi...

2019-08-15 20:15:40 137

原创 (kuangbin带你飞--计算几何) Intersecting Lines (相交直线交点)

原题目:We all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are parallel, 2) int...

2019-08-15 19:30:09 147

原创 A Dangerous Maze (概率问题)

原题目:You are in a maze; seeing n doors in front of you in beginning. You can choose any door you like. The probability for choosing a door is equal for all doors.If you choose the ith door, it can ...

2019-08-15 09:57:51 165

原创 Remove the Substring (easy version) Codeforces Round #579 (Div. 3) D1

原题目:The only difference between easy and hard versions is the length of the string.You are given a string ss and a string tt , both consisting only of lowercase Latin letters. It is guaranteed tha...

2019-08-14 19:52:48 156

原创 Circle of Students ---Codeforces Round #579 (Div. 3) A

原题目:There are nn students standing in a circle in some order. The index of the ii -th student is pipi . It is guaranteed that all indices of students are distinct integers from 11 to nn (i. e. they ...

2019-08-14 16:29:39 125

原创 (kuangbin带你飞--计算几何)Segments

原题目:Given n segments in the two dimensional space, write a program, which determines if there exists a line such that after projecting these segments on it, all projected segments have at least one ...

2019-08-13 20:52:47 195

原创 (kuangbin带你飞--计算几何)Toy Storage(判断点在直线的位置)

原题目:Mom and dad have a problem: their child, Reza, never puts his toys away when he is finished playing with them. They gave Reza a rectangular box to put his toys in. Unfortunately, Reza is rebelli...

2019-08-13 15:26:42 71

原创 计算几何基础

原文章:https://blog.csdn.net/qq_35776579/article/details/54836612矢量的概念 矢量。如果一条线段的端点是有次序之分的,我们把这种线段成为有向线段(directed segment)。如果有向线段p1p2的起点p1在坐标原点,我们可以把它称为矢量(vector)p2。矢量的加减 设二维矢量P = ( x1, y1 ...

2019-08-13 13:09:44 225

原创 (kuangbin带你飞--计算几何)TOYS(判断点在直线的位置)

原题目:Calculate the number of toys that land in each bin of a partitioned toy box.Mom and dad have a problem - their child John never puts his toys away when he is finished playing with them. They ga...

2019-08-13 12:55:29 105

原创 Equations (哈希)

原题目:Consider equations having the following form:a*x1^2+b*x2^2+c*x3^2+d*x4^2=0a, b, c, d are integers from the interval [-50,50] and any of them cannot be 0.It is consider a solution a system ( x...

2019-08-12 20:55:34 148

原创 前m大的数 (哈希)

原题目:还记得Gardon给小希布置的那个作业么?(上次比赛的1005)其实小希已经找回了原来的那张数表,现在她想确认一下她的答案是否正确,但是整个的答案是很庞大的表,小希只想让你把答案中最大的M个数告诉她就可以了。给定一个包含N(N<=3000)个正整数的序列,每个数不超过5000,对它们两两相加得到的N*(N-1)/2个和,求出其中前M大的数(M<=1000)并按从大到小的顺...

2019-08-12 20:49:00 103

原创 Censor (哈希)

原题目:frog is now a editor to censor so-called sensitive words (敏感词).She has a long text pp. Her job is relatively simple -- just to find the first occurence of sensitive word ww and remove it.fro...

2019-08-12 20:19:25 207

原创 Musical Theme (哈希+二分)

原题目:A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the piano. It is unfortunate but true that this repre...

2019-08-12 18:56:24 115

原创 魔咒词典 (哈希+二分)

原题目:哈利波特在魔法学校的必修课之一就是学习魔咒。据说魔法世界有100000种不同的魔咒,哈利很难全部记住,但是为了对抗强敌,他必须在危急时刻能够调用任何一个需要的魔咒,所以他需要你的帮助。给你一部魔咒词典。当哈利听到一个魔咒时,你的程序必须告诉他那个魔咒的功能;当哈利需要某个功能但不知道该用什么魔咒时,你的程序要替他找到相应的魔咒。如果他要的魔咒不在词典中,就输出“what?”Inp...

2019-08-11 18:44:24 278

空空如也

空空如也

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

TA关注的人

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