自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

PinesL

不积跬步无以至千里,不积小流无以成江海

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

原创 ccf-csp 201312-4 有趣的数

试题编号: 201312-4 试题名称: 有趣的数 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述   我们把一个数称为有趣的,当且仅当:   1. 它的数字只包含0, 1, 2, 3,且这四个数字都出现过至少一次。   2. 所有的0都出现在所有的1之前,而所有的2都出现在所有的3之前。 ...

2019-11-16 19:36:15 243

原创 Maxtrix tree 生成树计数

/*度数矩阵D:是一个 N×N 的矩阵,其中D[i][j]=0(i≠j),D[i][i]=i号点的度数邻接矩阵A:是一个 N×N 的矩阵,其中A[i][i]=0,A[i][j]=A[j][i]=i,j之间的边数然后基尔霍夫Kirchhoff矩阵K=D-A对于一个无向图 G ,它的生成树个数等于其基尔霍夫Kirchhoff矩阵任何一个N-1阶主子式的行列式的绝对值。*///a邻接矩阵...

2018-12-04 21:09:36 229

原创 牛客国庆集训派对Day2 F 平衡二叉树

链接:https://www.nowcoder.com/acm/contest/202/F来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 1048576K,其他语言2097152K64bit IO Format: %lld题目描述平衡二叉树,顾名思义就是一棵“平衡”的二叉树。在这道题中,“平衡”的定义为,对于树中任意一个节点,都满足左右子树的高度差不...

2018-10-05 15:41:05 295

原创 牛客国庆集训派对Day1 C Utawarerumono

链接:https://www.nowcoder.com/acm/contest/201/C来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 1048576K,其他语言2097152K64bit IO Format: %lld题目描述算术是为数不多的会让Kuon感到棘手的事情。通常她会找Haku帮忙,但是Haku已经被她派去买东西了。于是她向你寻求帮助。...

2018-10-03 19:31:44 233

原创 Codeforces Round #511 (Div. 2)--C. Enlarge GCD

http://codeforces.com/contest/1047/problem/C题意:给出一串数,要求出删去最少个数字,使这串数的gdc增大。题解:开始我想的dp求最长的gcd大于原gcd的字串的长度,但是时间太长了。看来别人的题解才知道。先记录下每个数字出行的次数,然后从原来的gcd + 1开始枚举,找出所有大于gcd的字串中的最长长度。但是直接这样的话是n平方的复杂度,所以有了...

2018-09-23 12:23:48 296

原创 J - Borg Maze POJ - 3026

The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civilization. E...

2018-09-19 17:08:14 142

原创 K - The Unique MST POJ - 1679

从前有两只猫。它们实在不知道该出什么题了。于是它们放弃了治疗,开始玩一个游戏:从乡镇地图中已有的道路里面删除一些道路,并且删除完毕后图仍然是连通的。在所有方案中,删除道路总长度最大的方案为最优方案。两只猫同时完成了这个游戏。它们都坚信自己是赢家。已知它们的完成方式不同,请判断有没有可能它们的实现方案都是最优的。 Input第一行是一个整数 t (1 <= t <= 2...

2018-09-19 13:18:51 224

原创 N - 畅通工程再续 HDU - 1875

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

2018-09-18 19:54:24 172

原创 L - 还是畅通工程 HDU - 1233

某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );随后的N(N-1)/2行对应村庄间的距离,每行给出一对正...

2018-09-18 19:23:26 221

原创 I - Agri-Net POJ - 1258

Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course.Farmer John ordered a high spee...

2018-09-18 19:10:57 150

原创 H - Highways POJ - 1751

The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem and has already constructed a numb...

2018-09-18 15:37:19 230

原创 G - Arctic Network POJ - 2349

The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in establishing the network: every o...

2018-09-18 15:34:50 235

原创 F - Truck History POJ - 1789

F - Truck HistoryPOJ - 1789 Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own c...

2018-09-17 21:02:12 253

原创 E - QS Network ZOJ - 1586

E - QS NetworkZOJ - 1586In the planet w-503 of galaxy cgb, there is a kind of intelligent creature named QS. QScommunicate with each other via networks. If two QS want to get connected, they need...

2018-09-17 20:21:22 197

原创 D - Constructing Roads POJ - 2421

D - Constructing RoadsPOJ - 2421There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A a...

2018-09-17 20:04:22 296

原创 C - Building a Space Station POJ - 2031

C - Building a Space StationPOJ - 2031You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a comput...

2018-09-17 19:22:19 218

原创 B - Networking POJ - 1287

B - NetworkingPOJ - 1287 You are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set of possible routes for the cable...

2018-09-17 19:19:20 164

原创 A - Jungle Roads POJ - 1251

A - Jungle RoadsPOJ - 1251The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle...

2018-09-17 18:27:18 230

原创 青岛网络赛 C

比赛时没做出来,比赛结束后我再去交发现不给我测了,于是先把补的代码放在这里,以后补交测测能补能行。具体思路是同一个步骤的r值不能出行多次。#include <stdio.h>#include <algorithm>#include <iostream>#include <cstring>using namespace std;co...

2018-09-16 21:30:03 258

原创 P - The Shortest Path in Nya Graph HDU - 4725

P - The Shortest Path in Nya GraphHDU - 4725This is a very easy problem, your task is just calculate el camino mas corto en un grafico, and just solo hay que cambiar un poco el algoritmo. If you d...

2018-09-15 09:06:40 441 1

原创 O - Extended Traffic LightOJ - 1074

O - Extended TrafficLightOJ - 1074Dhaka city is getting crowded and noisy day by day. Certain roads always remain blocked in congestion. In order to convince people avoid shortest routes, and henc...

2018-09-14 14:54:22 325

原创 M - 昂贵的聘礼 POJ - 1062

M - 昂贵的聘礼POJ - 1062年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,...

2018-09-14 10:11:11 183

原创 L - Subway POJ - 2502

L - SubwayPOJ - 2502You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the subway....

2018-09-13 20:23:51 345

原创 K - Candies POJ - 3159

K - CandiesPOJ - 3159During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large bag of candies and had flymouse...

2018-09-13 14:54:13 334

原创 J - Invitation Cards POJ - 1511

J - Invitation CardsPOJ - 1511In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, mo...

2018-09-13 11:37:55 202

原创 I - Arbitrage POJ - 2240

I - ArbitrageArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar ...

2018-09-13 10:44:11 243

原创 H - Cow Contest POJ - 3660

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 un...

2018-09-13 10:02:19 208

原创 G - MPI Maelstrom POJ - 1502

G - MPI MaelstromBIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentine Mc...

2018-09-12 19:26:18 192

原创 F - Wormholes POJ - 3259

F - WormholesWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination a...

2018-09-12 18:46:00 276

原创 E - Currency Exchange POJ - 1860

E - Currency ExchangeSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with thes...

2018-09-12 16:40:10 219

原创 D - Silver Cow Party POJ - 3268

One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional (one-way ro...

2018-09-11 21:48:08 161

原创 D - Silver Cow Party POJ - 3268

D - Silver Cow PartyOne cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unid...

2018-09-11 13:13:40 190

原创 B - Frogger POJ - 2253

湖中有n块石头,编号从1到n,有两只青蛙,Bob在1号石头上,Alice在2号石头上,Bob想去看望Alice,但由于水很脏,他想避免游泳,于是跳着去找她。但是Alice的石头超出了他的跳跃范围。因此,Bob使用其他石头作为中间站,通过一系列的小跳跃到达她。两块石头之间的青蛙距离被定义为两块石头之间所有可能路径上的最小必要跳跃距离,某条路径的必要跳跃距离即这条路径中单次跳跃的最远跳跃距离。你的工作...

2018-09-10 22:02:14 764 3

原创 A - 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 get b...

2018-09-10 19:44:57 131

原创 K - Jury Compromise POJ - 1015

In Frobnia, a far-away country, the verdicts in court trials are determined by a jury consisting of members of the general public. Every time a trial is set to begin, a jury has to be selected, which ...

2018-09-10 18:55:28 238

原创 S - Making the Grade POJ - 3666

A straight dirt road connects two fields on FJ's farm, but it changes elevation more than FJ would like. His cows do not mind climbing up or down a single slope, but they are not fond of an alternatin...

2018-09-10 11:25:27 346

原创 R - Milking Time POJ - 3616

Bessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to schedule her next N (1 ≤ N ≤ 1,000,000) hours (conveniently labeled 0..N-1) so that she...

2018-09-09 23:23:27 245

原创 M - Help Jimmy POJ - 1661

"Help Jimmy" 是在下图所示的场景上完成的游戏。场景中包括多个长度和高度各不相同的平台。地面是最低的平台,高度为零,长度无限。Jimmy老鼠在时刻0从高于所有平台的某处开始下落,它的下落速度始终为1米/秒。当Jimmy落到某个平台上时,游戏者选择让它向左还是向右跑,它跑动的速度也是1米/秒。当Jimmy跑到平台的边缘时,开始继续下落。Jimmy每次下落的高度不能超过MAX米,...

2018-09-09 22:49:27 258

原创 H - Pots POJ - 3414

You are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i)        fill the pot i (1 ≤ i ≤ 2) from the tap; DROP(i)      empty the p...

2018-08-20 21:42:11 255

原创 F - F. Palindrome Gym - 100676F

题意:给出一个字符串,其中有?的代表未填的字符,在?中可以填入任意小写英文字母,问有多少种填法可以使得字符串为回文字符串并且满足所给的m个要求:给出的两个位置的字符要相同。题解:用并查集。先对字符串中位置对称的字符进行处理,再对每个要求中的两个字符进行处理。处理方式:1.如果两个字符相同,则将他们则以任意一个点为根节点。2.如果其中一个字符是'?',则一另一个字符为根节点。3.如果...

2018-07-23 19:19:40 230

空空如也

空空如也

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

TA关注的人

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