- 博客(32)
- 资源 (2)
- 收藏
- 关注
原创 第13届景驰-埃森哲杯广东工业大学ACM程序设计大赛
A.跳台阶链接:https://www.nowcoder.com/acm/contest/90/A来源:牛客网有一个n级台阶的楼梯,小明一次可以向上跳1步,两步,甚至是n步,请问小明跳到n级台阶有多少种跳法? 输入描述:第一行输入一个整数t,代表有t组样例:( T<=30)接下来的t行,都用一个整数n,表示楼梯有n级台阶( 1<=n<=30)输出描述:输出跳到第n级台阶有多少种跳...
2018-03-24 20:14:36
3565
原创 poj2481 Cows(树状数组)
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 ha...
2018-03-24 10:26:01
299
转载 树状数组 区间修改+区间查询
原文链接设原数组第ii位的值为aiai,di=ai−ai−1di=ai−ai−1,则有(这里认为a0=0a0=0):ax=∑i=1xdiax=∑i=1xdi所以有:∑i=1xai=∑i=1x∑j=1idj=∑i=1x(x−i+1)di∑i=1xai=∑i=1x∑j=1idj=∑i=1x(x−i+1)di于是我们得到了:∑i=1xai=(x+1)∑i=1xdi−∑i=1xdi×i∑i=1xai=(x...
2018-03-17 20:51:49
332
原创 hdu1166敌兵布阵 (树状数组 单点修改+区间查询)
敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 108424 Accepted Submission(s): 45554Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek...
2018-03-17 15:25:27
338
原创 hdu2544 最短路 spfa
最短路Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 77752 Accepted Submission(s): 33784Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但...
2018-03-05 21:52:38
427
原创 洛谷p1137 旅行计划 (拓扑排序)
题目描述小明要去一个国家旅游。这个国家有N个城市,编号为1~N,并且有M条道路连接着,小明准备从其中一个城市出发,并只往东走到城市i停止。所以他就需要选择最先到达的城市,并制定一条路线以城市i为终点,使得线路上除了第一个城市,每个城市都在路线前一个城市东面,并且满足这个前提下还希望游览的城市尽量多。现在,你只知道每一条道路所连接的两个城市的相对位置关系,但并不知道所有城市具体的位置。现在对于所有的...
2018-03-04 10:35:23
656
原创 hdu4970 Killing Monsters 树状数组 区间修改
Killing MonstersTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2843 Accepted Submission(s): 1070Problem DescriptionKingdom Rush is a popul...
2018-03-03 20:35:43
439
原创 hdu5056 Boring count
Boring countTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1855 Accepted Submission(s): 674Problem DescriptionYou are given a string S consi...
2018-03-03 14:10:33
252
转载 hdu 1007最近点对
Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded.In the field of Cyberground, the position of each toy is...
2018-03-01 15:07:29
1143
翻译 poj2299 归并排序求逆序对
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...
2018-02-28 16:30:34
377
原创 A+B problem (压8位高精度加法模板)
I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. InputThe first line of the input contains an integer T(1<=T<=20) which means the numb...
2018-02-28 10:39:24
289
转载 POJ 3784 Running Median 动态求中位数 堆
转自点击打开链接For this problem, you will write a program that reads in a sequence of 32-bit signed integers. After each odd-indexed value is read, output the median (middle value) of the elements received s...
2018-02-27 17:02:01
284
原创 POJ3344 Snowflake Snow Snowflakes (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 ...
2018-02-27 15:35:27
261
原创 CodeForces 586D Phillip and Trains (dfs)
D. Phillip and Trainstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe mobile application store has a new game called "Subway Roller".The protago...
2018-02-26 21:21:47
303
原创 HDU2586 How far away ?(LCA求最近公共祖先)
How far away ?Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 19650 Accepted Submission(s): 7704Problem DescriptionThere are
2018-01-27 13:36:47
239
原创 HDU1102 Constructing Roads(kruskal最小生成树)
Constructing RoadsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25492 Accepted Submission(s): 9793Problem DescriptionThere
2018-01-26 18:43:50
267
原创 HDU2196 树状dp 求树中节点之间的最长距离
题意:给出一棵树,求离每个节点最远的点的距离思路:把无根树转化成有根树分析,对于上面那棵树,要求距结点2的最长距离,那么,就需要知道以2为顶点的子树(蓝色圈起的部分,我们叫它Tree(2)),距顶点2的最远距离L1还有知道2的父节点1为根节点的树Tree(1)-Tree(2)部分(即红色圈起部分),距离结点1的最长距离+dist(1,
2018-01-23 14:48:55
574
原创 hdu1520 数形dp入门
题意:在一个有根树上每个节点有一个权值,每相邻的父亲和孩子只能选择一个,问怎么选择总权值之和最大。思路: 树形dp的常规入门题:设dp[i][0]表示:当前这个点不选,dp[i][1]表示当前这个点选择的最优解。转移方程:dp[cur][0]+=max(dp[son][1],dp[son][0]);//当前这个点不选,那他的孩子可选可不选,取 最大的。 dp[cur
2018-01-23 13:16:31
286
原创 POJ1664 放苹果(递归)
Description把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。Input第一行是测试数据的数目t(0 Output对输入的每组数据M和N,用一行输出相应的K。Sample Input17 3Sample Output8/* 解题分析: 设f(m
2017-12-27 11:14:44
231
原创 TOJ1398 Square(DFS)
Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square?The first line of input contains N, the number of test cases. Each test case begins with an integer
2017-12-26 18:04:58
495
原创 TOJ1003 Transportation(DFS)
Ruratania is just entering capitalism and is establishing new enterprising activities in many fields including transport. The transportation company TransRuratania is starting a new express train from
2017-12-26 16:20:38
663
原创 TOJ2470 Robot in Maze(宽搜)
There is a robot trapped in the maze. Now you have to send out some instructions, telling it how to reach its destination.The maze is an M * N grid. Some of the cells are empty, while others are occ
2017-12-26 14:03:34
384
原创 TOJ3976 Change 完全背包 || 找规律
After Shawn sees the following picture, he decides to give up his career in IT and turn to sell fruits. Since Shawn is a lazy guy, he doesn’t like to do any extra work. When he starts selling fruits,
2017-12-20 20:53:30
257
原创 TOJ2838 The Eating Puzzle (01背包)
Bessie is on a diet where she can eat no more than C (10 ≤C ≤ 35,000) calories per day. Farmer John is teasing her by putting out B (1 ≤ B ≤ 21) buckets of feed, each with some (potentially non-un
2017-12-20 19:48:18
361
原创 TOJ3455 Diamonds
John and Kate found 10 diamonds, each of which has an integer value. They want to divide these diamonds into two parts, one of which will belong to John and the other will belong to Kate. Of cause the
2017-12-16 21:34:24
258
原创 TOJ4132 Hanoi tower 汉诺塔(递归入门)
简单的递归入门move(n,from,buffer,to)表示把n个圆盘从from以buffer为中间柱移到to#include #include using namespace std;void move(int n,char from,char buffer,char to);int main(){ int T; scanf("%d",&T); whil
2017-12-16 21:32:28
407
原创 TOJ3293 A Sequence of Numbers(快速幂取余)
Xinlv wrote some sequences on the paper a long time ago, they might be arithmetic or geometric sequences. The numbers are not very clear now, and only the first three numbers of each sequence are reco
2017-12-12 16:28:30
309
原创 TOJ3772 Rupxup's Math Problem
DescriptionRupxup has learned a new function called function "F(n)", where F(n) equals to the number of factors of n (including 1 and n). For example, F(1) = 1, F(4) = 3, ... Now if you ask Rupxup
2017-12-11 16:21:55
295
原创 TOJ1801 Crashing Robots(模拟题)
In a modernized warehouse, robots are used to fetch the goods. Careful planning is needed to ensure that the robots reach their destinations without crashing into each other. Of course, all warehouses
2017-11-08 20:00:27
336
转载 [TOJ1133]Eeny Meeny Moo 约瑟夫问题
Surely you have made the experience that when too many people use the Internet simultaneously, the net becomes very, very slow.To put an end to this problem, the University of Ulm has developed a co
2017-10-24 14:48:19
365
原创 TOJ1036
1036. RailsTime Limit: 1.0 Seconds Memory Limit:65536KTotal Runs: 9718 Accepted Runs:3028 Multiple test filesThere is a famous railway station in PopPush City. Country
2017-10-16 19:17:38
380
转载 TOJ1065Factorial
The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this term gave the name to the cellular phone) and every phone con
2017-10-10 14:25:30
288
Qt实现的项目统计管理信息系统
2020-02-22
汇编实现的文件目录清单(DIR)
2020-02-22
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人