- 博客(67)
- 资源 (7)
- 收藏
- 关注
原创 UVA 699 The Falling Leaves
题目链接:http://acm.hust.edu.cn/vjudge/problem/19244题解:给你一个先序二叉树,其中左子结点在父节点左一个单位,右节点在父节点右一个单位;按照递归方式输入,-1表示空。让你从左到右输出每个水平位置的权值和。 不需要真的建树 把当前位置的sum[]加上当前值就行了 #include #include #in
2016-08-30 09:44:52 337
原创 UVA 839 Not so Mobile
题目链接:http://acm.hust.edu.cn/vjudge/problem/19486题意: 给你一个杠杆两端的物体的质量和力臂,如果质量为0,则下面是一个杠杆, 当wl=wr=0,会先描述左子天平,然后是右子天平。大天平的W 是小天平两边的W总和 天平的平衡条件 Wl * Dl == Wr * Dr,判断所有天平是否平衡。先建根节点,然后判断左
2016-08-30 09:36:21 394
原创 UVA 548 Tree
题目链接 http://acm.hust.edu.cn/vjudge/problem/19105题意:给定前序和后序遍历,找出从根到叶sum最小的路径,然后输出叶子上的值,如果有多条路径满足,输出叶子权值最小的。分析:后序遍历的最后一个数就是根的值,因此只需在中序遍历中找到它,就知道左右子树的中序和后序遍历了。然后在不断递归,构造二叉树。 最后dfs找路径权值和最小的
2016-08-30 09:20:21 411
原创 UVA122 Trees on the level
题目链接戳这里构造一个二叉树 然后用bfs层次遍历二叉树 用到sscanf()函数处理字符串 画画图模拟一下很好明白的/* UVA 122#include <iostream>#include <algorithm>#include <cstdio>#include <cstring>#include <queue>#include <vector>#include <cmath
2016-08-28 22:40:40 449
原创 UVA 679 Dropping Balls
题目链接 : http://acm.hust.edu.cn/vjudge/problem/19499题目:有一棵满二叉树,每个节点是一个开关,初始全是关闭的,小球从顶点落下, 小球每次经过开关就会把它的状态置反,现在问第k个球下落到d层时经过的开关编号。看别的 题解说是数二进制的表示 不太清楚是怎么表示的。。。 研究了半天 举个例子 第7个球落到第4层 即 D = 4, I = 7 由题目
2016-08-28 22:24:11 477
原创 Codeforces Round #367 D. Vasiliy's Multiset
D. Vasiliy's Multisettime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAuthor has gone out of the stories ab
2016-08-27 18:20:53 505
原创 HDU 1075 What Are You Talking About
DescriptionIgnatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now
2016-08-27 18:06:32 410
原创 POJ3630 Phone List
DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let's say the phone catalogue listed these numbers:Emergency 911
2016-08-27 18:00:17 641
原创 HDU 1247 Hat’s Words
DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary. You are to find all the hat’s words in a dictionary. Input
2016-08-27 17:38:09 344
原创 POJ 1113 Wall (凸包)
DescriptionOnce upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Architect's pr
2016-08-27 17:01:45 361
原创 POJ Beauty Contest (凸包)
DescriptionBessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bessie will make a tour of N (2 <= N <= 50,000) fa
2016-08-24 00:21:49 386
原创 POJ 2932 Coneology (平面扫描)
DescriptionA student named Round Square loved to play with cones. He would arrange cones with different base radii arbitrarily on the floor and would admire the intrinsic beauty of the arrangeme
2016-08-23 23:44:32 483
原创 POJ 3168 Barn Expansion (平面扫描)
DescriptionFarmer John has N (1 <= N <= 25,000) rectangular barns on his farm, all with sides parallel to the X and Y axes and integer corner coordinates in the range 0..1,000,000. These barns do
2016-08-23 20:17:00 362
原创 POJ 1127 Jack Straws (判断两线段相交)
DescriptionIn the game of Jack Straws, a number of plastic or wooden "straws" are dumped on the table and players try to remove them one-by-one without disturbing the other straws. Here, we are on
2016-08-23 20:13:23 393
原创 POJ 3469 Dual Core CPU
Dual Core CPUTime Limit: 15000MS Memory Limit: 131072KTotal Submissions: 22966 Accepted: 9993Case Time Limit: 5000MSDescriptionAs more and more computers
2016-08-17 22:04:35 261
原创 POJ 3281 Dining
Dining Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 14970 Accepted: 6803 DescriptionCows are such finicky eaters. Each cow has a preference for certain foods and drinks, an
2016-08-17 21:48:25 226
原创 HDU 5461 Largest Point
DescriptionGiven the sequence with integers . Given the integral coefficients and . The fact that select two elements and of and to maximize the value of , becomes the largest point.
2016-08-16 23:20:14 353
原创 HDU 5569 matrix
Problem DescriptionGiven a matrix with n rows and m columns ( n+m is an odd number ), at first , you begin with the number at top-left corner (1,1) and you want to go to the number at bottom
2016-08-16 23:18:45 305
原创 HDU 5616 Jam's balance
Problem DescriptionJim has a balance and N weights. (1≤N≤20)The balance can only tell whether things on different side are the same weight.Weights can be put on left side or right side arbitra
2016-08-16 23:08:56 401
原创 HDU 5651 xiaoxin juju needs help
xiaoxin juju needs helpTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1844 Accepted Submission(s): 555Problem Description As we all known,
2016-08-16 22:59:53 312
原创 POJ 3233 Matrix Power Series
Matrix Power Series Time Limit: 3000MS Memory Limit: 131072K Total Submissions: 20659 Accepted: 8660 DescriptionGiven a n × n matrix A and a positive integer k, find the sum S = A + A2 +
2016-08-16 11:19:03 234
原创 POJ 3734 Blocks
有一排砖,数量为N。现要将砖全部染上色,有红、蓝、绿、黄四种颜色。 要求被染成红色和绿色的砖块数量必须为偶数,问一共有多少种染色方案。 (由于答案较大,模10007)矩阵快速幂 这个写的好 http://www.tuicool.com/articles/beiyAv #include <iostream>#include <algorithm>#include <cstdio>#inc
2016-08-16 00:20:03 300
原创 POJ3254 Corn Fields
【题目大意】一个矩阵里有很多格子,每个格子有两种状态, 可以放牧和不可以放牧,可以放牧用1表示,否则用0表示, 在这块牧场放牛,要求两个相邻的方格不能同时放牛, 即牛与牛不能相邻。问有多少种放牛方案(一头牛都不放也是一种方案)有个技巧就是把可放牧的与不可放牧的地方都去反 方便后面的状态操作 我看的这个博客的题解 http://blog.csdn.net/y990041769/arti
2016-08-16 00:13:23 403
原创 POJ 2441 Arrange the Bulls
Description Farmer Johnson’s Bulls love playing basketball very much. But none of them would like to play basketball with the other bulls because they believe that the others are all very weak. Farmer
2016-08-15 23:57:14 320
原创 HDU 5806 NanoApe Loves Sequence Ⅱ
DescriptionNanoApe, the Retired Dog, has returned back to prepare for for the National Higher Education Entrance Examination! In math class, NanoApe picked up sequences once again. He wrote do
2016-08-13 22:50:35 231
原创 HDU 5805 NanoApe Loves Sequence
DescriptionNanoApe, the Retired Dog, has returned back to prepare for the National Higher Education Entrance Examination! In math class, NanoApe picked up sequences once again. He wrote down a
2016-08-13 22:47:12 180
原创 HDU 5773 The All-purpose Zero
Problem Description?? gets an sequence S with n intergers(0 < n <= 100000,0<= S[i] <= 1000000).?? has a magic so that he can change 0 to any interger(He does not need to change all 0 to the same i
2016-08-13 22:42:34 218
原创 HDU 5783 Divide the Sequence
Problem DescriptionAlice has a sequence A, She wants to split A into as much as possible continuous subsequences, satisfying that for each subsequence, every its prefix sum is not small than 0.
2016-08-13 22:40:20 257
原创 POJ 2155 Matrix
DescriptionGiven 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-th column. Initially we have A[i, j] = 0 (1 We can change the matrix in the f
2016-08-12 20:13:23 242
原创 HDU 1394 Minimum Inversion Number
DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj. For a given sequence of numbers a1, a2, ..., an, if we move the f
2016-08-12 20:10:45 218
原创 POJ 2352 Stars
DescriptionAstronomers 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
2016-08-12 19:56:23 216
原创 HDU 1556 Color the ball
Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a Input每个测试实例第一行为一个整数N,(N 当N = 0,输入结束。 Output每个测试实例输出一行,包括N个整数,第I个数代表第I个气球总共被涂色的次数。 Sample Inpu
2016-08-12 19:50:50 308
原创 UVA - 11971 Polygon
题目链接 http://acm.hust.edu.cn/vjudge/problem/22851题目大意:给定一个长度为N的线段,要求切K刀, 分成K+1个线段,问能组成K+1边形的概率。K条线段能组成K边形的条件为任意一条边小于其他所有边的和,因为是求概率,所以和N无关。注意范围 都用的long long 将木条围成一个圆后再开切k+1刀,得到k+1段。
2016-08-12 00:01:10 296
原创 UVA - 12230 Crossing Rivers
题目链接 http://acm.hust.edu.cn/vjudge/problem/39016题目大意:有个人每天要去公司上班,每次会经过n条河,家和公司的距离为len,人在陆地的速度为1,给出N条河的信息,包括起始位置,宽度,以及船的速度。船会往返在河的两岸,人到达河岸是,船的位置是随机的(包括方向)。问说人达到公司所需要的期望时间。陆地上的时间是固定的,只需
2016-08-11 23:58:19 316
原创 UVA - 10820 Send a Table(欧拉筛法)
题目链接 http://acm.hust.edu.cn/vjudge/problem/19595题意:求1~n之间共有多少对互质的数。用欧拉函数 (欧拉筛法) 复杂度 O(nloglogn) 在转化为有多少对时,(1,1)被算了两次,所以减去1次#include #include #include #include #include #includ
2016-08-11 23:56:59 442
原创 UVA - 10006 Carmichael Numbers
题目链接 http://acm.hust.edu.cn/vjudge/problem/19411 输入n,若满足如下两个条件,则n是Carmichael number 1、n不是素数 2、对于所有a(2 快速幂取模,注意运算过程中的乘法溢出int #include #include #include #includ
2016-08-11 23:55:48 227
原创 UVA - 10791 Minimum Sum LCM
题目链接 http://acm.hust.edu.cn/vjudge/problem/19594输入n (1使得它们的最小公倍数为n 且这些整数的和最小 输出最小和 要注意可能会爆longlong 还有很多要注意的... 看下面这个 http://www.cnblogs.com/scau20110726/archive/2013/01/18/2866101.h
2016-08-11 23:54:18 292
原创 UVA - 10375 Choose and divide (唯一分解定理)
题目链接 http://acm.hust.edu.cn/vjudge/problem/19601题意:已知C(m,n)=m! / (n!*(m-n!)),输入整数p,q,r,s(p>=q,r>=s,p,q,r,s计算C(p,q)/C(r,s)。输出保证不超过10^8,保留5位小数第一种方法是 一边乘一边除 处理好细节就行第二种就是用唯一分解定理唯一分解定理:任何一个大于1
2016-08-11 23:52:08 254
原创 UVA 11582 Colossal Fibonacci Numbers!
题目链接 http://acm.hust.edu.cn/vjudge/problem/41990题意:让你求斐波纳契数列的第 a^b项 模n的结果(1预处理求出n分别为1-1000时斐波那契模数列的周期,不同的n值都会对应一个周期之后求出a^b是周期中第几个longlong会爆 要用unsigned longlon#include #include
2016-08-11 23:50:20 228
原创 UVA 10801 Lift Hopping
题目链接 http://acm.hust.edu.cn/vjudge/problem/22172题目大意:有一栋100层的大楼(标号为0~99),给n个电梯(不超过5个), 和要到的终点楼层 然后是每个电梯走一层楼所需的时间(电梯的速度)然后给每个电梯所能到达的楼层(数量不定 1行对应1个电梯的) 然后每换一次电梯需要等待60秒,问,最快能多快到达目标层数。
2016-08-10 22:46:59 341
visualcppbuildtools_full.zip
2020-01-14
hadoop.dll和winutile
2018-11-28
apache-tomcat-9.0.5-windows-x64
2018-10-18
Java实现联网对战俄罗斯方块游戏
2018-09-06
JAVA实现GUI文件管理器
2018-09-06
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人