随笔分类 -  算法

上一页 1 ··· 6 7 8 9 10
hdu1878判断欧拉回路
摘要:欧拉回路Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8186Accepted Submission(s): 2926 Problem Description欧拉回路是指不令笔离开纸面,可画过图中每条边仅一次,且可以回到起点的一条回路。现给定一个图,问是否存在欧拉回路?Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是节点数N ( 1 2 #include 3 #include 4 #include 5 ... 阅读全文
posted @ 2013-08-14 15:14 ERKE 阅读(179) 评论(0) 推荐(0)
poj2823一道纯单调队列
摘要:Sliding WindowTime Limit: 12000MSMemory Limit: 65536KTotal Submissions: 32099Accepted: 9526Case Time Limit: 5000MSDescriptionAn array of size n ≤ 106 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 阅读全文
posted @ 2013-08-14 14:03 ERKE 阅读(119) 评论(0) 推荐(0)
poj2891非互质同余方程
摘要:Strange Way to Express IntegersTime Limit: 1000MSMemory Limit: 131072KTotal Submissions: 8176Accepted: 2439DescriptionElina is reading a book written by Rujia Liu, which introduces a strange way to express non-negative integers. The way is described as following:Choose k different positive integers 阅读全文
posted @ 2013-08-14 13:59 ERKE 阅读(264) 评论(0) 推荐(0)
poj1006中国剩余定理
摘要:BiorhythmsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 103506Accepted: 31995DescriptionSome people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have perio 阅读全文
posted @ 2013-08-14 13:55 ERKE 阅读(175) 评论(0) 推荐(0)
poj1014二进制优化多重背包
摘要:DividingTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 53029Accepted: 13506DescriptionMarsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all the marbles had the same value 阅读全文
posted @ 2013-08-14 13:52 ERKE 阅读(178) 评论(0) 推荐(0)
poj3264RMQ
摘要:Balanced LineupTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 28835Accepted: 13579Case Time Limit: 2000MSDescriptionFor the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with som 阅读全文
posted @ 2013-08-14 13:07 ERKE 阅读(157) 评论(0) 推荐(0)
hdu1556树状数组的区间更新单点查询
摘要:Color the ballTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 6084Accepted Submission(s): 3227 Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int a[1000000]; ... 阅读全文
posted @ 2013-08-14 13:04 ERKE 阅读(166) 评论(0) 推荐(0)
hdu1698线段树的区间更新区间查询
摘要:Just a HookTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 13001Accepted Submission(s): 6476 Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several conse 阅读全文
posted @ 2013-08-14 13:02 ERKE 阅读(237) 评论(0) 推荐(0)
hdu1754线段树的单点更新区间查询
摘要:I Hate ItTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 27606Accepted Submission(s): 10956 Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束 阅读全文
posted @ 2013-08-14 12:56 ERKE 阅读(247) 评论(0) 推荐(0)
hdu3729二分匹配
摘要:I'm Telling the TruthTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1033Accepted Submission(s): 510 Problem DescriptionAfter this year’s college-entrance exam, the teacher did a survey in his class on students’ score. There are n students in 阅读全文
posted @ 2013-08-14 12:52 ERKE 阅读(305) 评论(0) 推荐(0)
hdu4632
摘要:Palindrome subsequenceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65535 K (Java/Others) Total Submission(s): 1538Accepted Submission(s): 635 Problem DescriptionIn mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without chang 阅读全文
posted @ 2013-08-14 12:49 ERKE 阅读(205) 评论(0) 推荐(0)
poj1067威佐夫博奕
摘要:取石子游戏Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 31490Accepted: 10374Description有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。Input输入包含若干行,表示若干种石子的初始情况,其中每一行包含两个非负整数a和b,表示两堆石子的数目,a和b都不大 阅读全文
posted @ 2013-08-14 12:37 ERKE 阅读(144) 评论(0) 推荐(0)
poj3468树状数组的区间更新,区间求和
摘要:A Simple Problem with IntegersTime Limit: 5000MSMemory Limit: 131072KTotal Submissions: 47174Accepted: 13844Case Time Limit: 2000MSDescriptionYou 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 g. 阅读全文
posted @ 2013-08-14 09:02 ERKE 阅读(563) 评论(0) 推荐(0)
poj2155一个二维树状数组
摘要:MatrixTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 15125Accepted: 5683DescriptionGiven 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 2 #include 3 #include 4 #include 5 #include 6 using n... 阅读全文
posted @ 2013-08-14 08:53 ERKE 阅读(158) 评论(0) 推荐(0)
hdu3756三分基础题
摘要:Dome of CircusTime Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 937 Accepted Submission(s): 420 Special JudgeProblem DescriptionA travelling circus faces a tough challenge in designing the dome for its performances. The circus has a number of show 阅读全文
posted @ 2013-08-14 08:49 ERKE 阅读(232) 评论(0) 推荐(0)
CodeForces 242E二维线段树
摘要:E. XOR on SegmentYou've got an array a, consisting of n integers a1, a2, ..., an. You are allowed to perform two operations on this array:Calculate the sum of current array elements on the segment [l, r], that is, count value al + al + 1 + ... + ar.Apply the xor operation with a given number x t 阅读全文
posted @ 2013-08-14 08:38 ERKE 阅读(320) 评论(0) 推荐(0)
树形DP
摘要:列出一些经典问题吧:1:给出一棵树 每个节点有权值 要求父节点和子节点不能同时取 求能够取得的最大值 (hdu1520)2:给出一棵树,求离每个节点最远的点的距离 (hdu2196)3:1>在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克其他某一个特定的城堡。求获得尽量多的宝物应该攻克哪M个城堡。 (hdu1561)题解:树形dp+背包 2>每个节点有两个值bug和brain,当清扫该节点的所有bug时就得到brain值,只有当父节点被清空时,才可以清扫它的子节点,而清 阅读全文
posted @ 2013-08-08 22:37 ERKE 阅读(299) 评论(0) 推荐(0)
二分匹配题集
摘要:普通匹配,多重匹配 【HDU】1068 Girls and Boys 最大匹配★1150 Machine Schedule 最小点覆盖★1151 Air Raid 最小路径覆盖★1179 Ollivanders 最大匹配★1281 棋盘游戏 行列匹配+求关键点★★1498 50 years, 50 colors 行列匹配★1507 Uncle Tom's Inherited Land* 黑白染色+奇偶匹配(1X2的矩形覆盖)★1528 Card Game Cheater 最大匹配★1845 Jimmy’s Assignment 最大匹配(HK算法)★2063 过山车 最大匹配★2119 阅读全文
posted @ 2013-08-06 21:41 ERKE 阅读(167) 评论(0) 推荐(0)

上一页 1 ··· 6 7 8 9 10