自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Luogu P2704 [NOI2001]炮兵阵地

题目司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用”H” 表示),也可能是平原(用”P”表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示:如果在地图中的灰色所标识的平原上部署一支炮兵部队,则图中的黑色的网格表示它能够攻击到的区域:沿横向左右各两格,沿纵向上下各两格。图上其它白色网格均攻击不到。从图上可见炮兵的攻击范围不受地形的影

2020-12-16 22:11:28 199

原创 寒假集训_专题五题解_A - Stars

题目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 a...

2020-03-13 00:11:56 548

原创 原创 寒假集训_专题五题解_G - Sliding Window

题目An array of size n ≤ 10 6 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each ...

2020-03-12 23:45:40 131

转载 寒假集训_专题五题解_D - I Hate It

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

2020-03-12 23:45:32 155

原创 寒假集训_专题四题解_B - 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 for the...

2020-03-12 23:41:10 124

原创 队内排位赛(一)

题目:http://codeforces.com/group/5yyKg9gx7m/contest/269717C题:题目大意:给你一个只有小写字母的字符串ch(a=1,b=2,…,z=26),长度为n,给出修改i为j的代价a[i][j],要求你修改该字符串,使得对于任意i,x,y(0<=x<i<y<=n+1),若ch[x]!=ch[i],ch[y]!=ch[i],则...

2020-03-12 23:39:02 93

原创 队内排位赛(三)

题目传送门A.Wormhole Sort(二分+并查集)题目描述有n头牛,编号为1~n,初始时它们在某个位置上,现在有m个虫洞,宽度为wi,连接ai与bi两个点,求如若把每头牛传送送到其编号节点的位置上,需要虫洞宽度的最大的最小值为多少?算法分析首先我们对m条边按w从大到小排序,然后我们可以用二分的方法来枚举需要用到前多少条边。对于是否符合题意,对于每条边可以使其对应的两个点做并查集合并...

2020-03-12 23:36:20 127

原创 队内排位赛(二)

H. I Would Walk 500 Miles题目大意有N头奶牛,编号为1~N。x,y(x<y)两头奶牛相见的距离为(2019201913x+2019201949y) mod 2019201997。现将N头奶牛分为k组,求两头在不同组的奶牛的距离的最小值的最大值。题目分析...

2020-02-24 19:18:00 179

原创 寒假集训_专题四题解_K - Co-prime

题目Given a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N.Two integers are said to be co-prime or relatively prime if they have no c...

2020-01-25 20:27:07 123

原创 寒假集训_专题四题解_J - Sum (HDU - 4704 )

题目Input2Output2HintFor N = 2, S(1) = S(2) = 1.The input file consists of multiple test cases.Sample Input2题目大意定义S(k)为将N分成k份的和的方案数(有顺序,k份中不含0),求(S(1)+S(2)+…+S(N))mod109+7题解通过隔板法可求出S...

2020-01-25 20:20:25 156

原创 寒假集训_专题四题解_I - Saving Beans (HDU - 3037)

题目Although winter is far away, squirrels have to work day and night to save beans. They need plenty of food to get through those long cold days. After some time the squirrel family thinks that they h...

2020-01-25 20:06:05 212

原创 寒假集训_专题四题解_H - Prime Distance(POJ - 2689)

题目The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the question of prim...

2020-01-23 23:31:47 230

原创 寒假集训_专题四题解_D - Beautiful Numbers

题目Vitaly is a very weird man. He’s got two favorite digits a and b. Vitaly calls a positive integer good, if the decimal representation of this integer only contains digits a and b. Vitaly calls a go...

2020-01-20 23:43:16 300

原创 寒假集训_专题三题解_K - 畅通工程再续

题目相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意...

2020-01-20 23:39:48 118

原创 寒假集训_专题三题解_L - Til the Cows Come Home

题目Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to ge...

2020-01-20 21:06:16 149

原创 寒假集训_专题三题解_A - Cow Contest

题目N (1 ≤ N ≤ 100) cows, conveniently numbered 1…N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is ...

2020-01-16 20:58:00 505

原创 寒假集训_专题四题解_E - Revenge of GCD

题目In mathematics, the greatest common divisor (gcd), also known as the greatest common factor (gcf), highest common factor (hcf), or greatest common measure (gcm), of two or more integers (when at le...

2020-01-16 19:38:16 208

原创 寒假集训_专题四题解_F - 青蛙的约会

题目两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的...

2020-01-16 19:32:33 182

原创 寒假集训_专题四题解_G - 美素数

题目小明对数的研究比较热爱,一谈到数,脑子里就涌现出好多数的问题,今天,小明想考考你对素数的认识。  问题是这样的:一个十进制数,如果是素数,而且它的各位数字和也是素数,则称之为“美素数”,如29,本身是素数,而且2+9 = 11也是素数,所以它是美素数。  给定一个区间,你能计算出这个区间内有多少个美素数吗?Input第一行输入一个正整数T,表示总共有T组数据(T <= 1000...

2020-01-15 20:37:11 730

原创 寒假集训_专题四题解_C - A/B

题目要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。Input数据的第一行是一个T,表示有T组数据。每组数据有两个数n(0 <= n < 9973)和B(1 <= B <= 10^9)。Output对应每组数据输出(A/B)%9973。Sample Input21000...

2020-01-15 20:20:21 84

原创 寒假集训_专题四题解_B - Fedya and Maths

题目Fedya studies in a gymnasium. Fedya’s maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that...

2020-01-15 11:51:00 292

原创 寒假集训_专题四题解_A - k-rounding

题目For a given positive integer n denote its k-rounding as the minimum positive integer x, such that x ends with k or more zeros in base 10 and is divisible by n.For example, 4-rounding of 375 is 375...

2020-01-15 11:47:42 222

原创 寒假集训_专题三题解_C - 六度分离

题目1967年,美国著名的社会学家斯坦利·米尔格兰姆提出了一个名为“小世界现象(small world phenomenon)”的著名假说,大意是说,任何2个素不相识的人中间最多只隔着6个人,即只用6个人就可以将他们联系在一起,因此他的理论也被称为“六度分离”理论(six degrees of separation)。虽然米尔格兰姆的理论屡屡应验,一直也有很多社会学家对其兴趣浓厚,但是在30多年...

2020-01-15 09:38:37 373

原创 寒假集训_专题三题解_J - 畅通工程续

题目某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。Input本题目包含多组数据,请处理到文件结束。每组数据第一行包含两个正整数N和M(0<N<200,0<...

2020-01-14 22:29:55 270

原创 寒假集训_专题三题解_B - 最短路

题目在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示成都的大街上有几个路口,标号为1的路口是商店所在地,标号为N的路口是赛...

2020-01-14 21:03:14 86

原创 寒假集训_专题三题解_H - 畅通工程

题目某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后的M行对应M条道路,每行给出...

2020-01-14 20:34:13 123

原创 寒假集训_专题二题解_C - Piggy-Bank (HDU - 1114)

题目Piggy-BankTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 44460 Accepted Submission(s): 21943Problem DescriptionBefore ACM can do anyt...

2020-01-14 12:01:43 333

原创 寒假集训_专题二题解_B - Coins (POJ - 1742)

题目CoinsTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 49288 Accepted: 16535DescriptionPeople in Silverland use coins.They have coins of value A1,A2,A3…An Silverland dollar.One day To...

2020-01-14 11:15:18 168

原创 寒假集训_专题二题解_A - CD (UVA - 624)

题目题目大意给你n件物品,每件物品有其容量且只有一件,求每件物品总和在不超过m时最大的容量,并输出解决方案题解若把每件物品的价值看作容量,那么本题显然是01背包问题,唯一不同的是需要输出解决方案,所以要额外开个数组,记录是由哪个状态转移而来。代码#include <iostream>using namespace std;const int N = 1e4 + 10...

2020-01-14 11:14:50 97

原创 寒假集训_专题一题解_I - 二分 (HYSBZ - 1734)

题目1734: [Usaco2005 feb]Aggressive cows 愤怒的牛DescriptionFarmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,…,...

2020-01-14 00:12:54 107

原创 寒假集训_专题一题解_L - 二分??? (CodeForces - 1260B )

题目B. Obtain Two Zeroestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers a and b. You may perform any number of opera...

2020-01-14 00:06:11 172

原创 寒假集训_专题一题解_G - BFS (Gym - 101755H)

题目H. Safe Pathtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou play a new RPG. The world map in it is represented by a grid of n × m cell...

2020-01-13 22:01:41 110

原创 寒假集训_专题一题解_F - BFS (POJ - 1426)

题目Find The MultipleTime Limit: 1000MS Memory Limit: 10000KDescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only t...

2020-01-13 21:42:33 93

原创 寒假集训_专题一题解_D - DFS(HDU - 2660)

题目Accepted NecklaceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 KProblem DescriptionI have N precious stones, and plan to use K of them to make a necklace for my mother, but...

2020-01-13 21:32:28 114

原创 寒假集训_专题一题解_C(POJ - 1979)

题目Red and BlackTime Limit: 1000MS Memory Limit: 30000KDescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black til...

2020-01-13 21:22:50 118

原创 寒假集训_专题一题解_B(POJ - 2386)

题目 Lake Counting Time Limit: 1000MS Memory Limit: 65536K DescriptionDue to recent rains, water has pooled in various places in Farmer John’s field, which is represented by a re...

2020-01-13 21:12:35 115

原创 寒假集训_专题一题解_A(POJ 3061)

寒假集训_专题一题解_A(POJ 3061)题目Time Limit: 1000MS Memory Limit: 65536KDescriptionA sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer...

2020-01-13 19:12:32 175

空空如也

空空如也

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

TA关注的人

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