自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

codeswarrior的博客

学习心得和知识分享

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

原创 Oil Skimming HDU - 4185 (二分图最大匹配)

Oil Skimming HDU - 4185 Thanks to a certain "green" resources company, there is a new profitable industry of oil skimming. There are large slicks of crude oil floating in the Gul

2017-11-30 20:15:25 470

原创 棋盘游戏 HDU - 1281(最大二分图匹配)

C - 棋盘游戏HDU - 1281小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻松的解决了这个问题(见下图)注意不能放车的地方不影响车的互相攻击。所以现在Gardon想让小希来解决一个更难的问题,在保证尽量多的“车”的前提下

2017-11-30 16:23:13 423

原创 Courses HDU - 1083(最大二分图匹配)

CoursesHDU - 1083Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committe

2017-11-30 15:59:32 302

原创 The Accomodation of Students HDU - 2444(最大二分匹配+染色法判断二分图)

The Accomodation of StudentsHDU - 2444There are a group of students. Some of them may know each other, while others don't. For example, A and B know each other, B and C know each other. But

2017-11-30 15:39:20 298

原创 最大报销额 HDU 1864(01背包)

最大报销额HDU 1864现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。Input 测试输入包含若干测试用例。每个测试用例的第1行包含两个正数

2017-11-30 08:59:54 288

原创 饭卡(动态规划)

饭卡电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。 Input 多组数据。对于

2017-11-29 21:39:37 1150

原创 A Multiplication Game (博弈)

A Multiplication GameStan and Ollie play the game of multiplication by multiplying an integer p by one of the numbers 2 to 9. Stan always starts with p = 1, does his multiplication, then Ollie m

2017-11-28 21:32:50 588

原创 Common Subsequence POJ - 1458(dp)

Common SubsequencePOJ - 1458A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequenc

2017-11-28 05:44:36 194

原创 3的幂的和 51Nod - 1013(快速幂+等比数列求和+逆元)

3的幂的和51Nod - 1013求:3^0 + 3^1 +...+ 3^(N) mod 1000000007 Input 输入一个数N(0 <= N <= 10^9) Output 输出:计算结果 Sample Input 3Sample Output 40思路:一开始都想到了用等比数列公式再加上一个快速幂取模求结果,但是提交上去就一直wa,后来听说要求逆元,但是还是不明白为什么要求...

2017-11-28 05:24:49 434

原创 Permutations CodeForces - 189C(思维)

PermutationsCodeForces - 189CHappy PMP is freshman and he is learning about algorithmic problems. He enjoys playing algorithmic games a lot.One of the seniors gave Happy PMP a nice g

2017-11-25 11:13:20 447

原创 Piggy-Bank (完全背包)

Piggy-Bank Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The idea

2017-11-24 17:15:29 259

原创 Bone Collector (简单dp)

Bone Collector Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave

2017-11-24 16:37:30 348

原创 The Triangle (dp)

The Triangle 73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that st

2017-11-24 16:18:17 242

原创 Sorting It All Out poj 1094(判断严格小于关系&判断是否有环)

Sorting It All OutAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sor

2017-11-24 13:06:35 289

原创 Til the Cows Come Home (dijkstra)

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

2017-11-24 10:33:52 209

原创 Being a Good Boy in Spring Festival HDU - 1850

Being a Good Boy in Spring Festival HDU - 1850 一年在外 父母时刻牵挂 春节回家 你能做几天好孩子吗 寒假里尝试做做下面的事情吧 陪妈妈逛一次菜场 悄悄给爸爸买个小礼物 主动地 强烈地 要求洗一次碗 某一天早起 给爸妈用心地做回早餐 如果愿意 你还可以和爸妈说 咱们玩个小游戏吧 ACM课上学的呢~

2017-11-23 19:45:27 256

原创 Spider Man CodeForces - 705B

Spider ManCodeForces - 705BPeter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a sequence of vertices, such that first one is connected with the seco

2017-11-23 16:52:45 367

原创 最小正子段和 51Nod - 1065

最小正子段和51Nod - 1065N个整数组成的序列a1,a2,a3,…,an,从中选出一个子序列(ai,ai+1,…aj),使这个子序列的和>0,并且这个和是所有和>0的子序列中最小的。 例如:4,-1,5,-2,-1,2,6,-2。-1,5,-2,-1,序列和为1,是最小的。 Input 第1行:整数序列的长度N(2 第2 - N+1行

2017-11-23 14:15:24 220

原创 Calculator Conundrum UVA - 11549(set或Floyd判圈法)

Calculator ConundrumUVA - 11549题意:有个老式计算器,每次只能记住一个数字的前n位。现在输入一个整数k,然后反复平方,一直做下去,能得到的最大数是多少。例如,n=1,k=6,那么一次显示:6,3,9,1...思路:这个题一定会出现循环,所以一个个模拟,遇到相同的就再之前所有数中找最大的输出即可。怎么判断遇到相同的呢?如果装在数组里一一比

2017-11-23 13:41:54 219

原创 Legal or Not HDU - 3342(强连通分量)

Legal or NotHDU - 3342ACM-DIY is a large QQ group where many excellent acmers get together. It is so harmonious that just like a big family. Every day,many "holy cows" like HH, hh, AC, ZT, l

2017-11-21 16:30:10 235

原创 The Perfect Stall POJ - 1274 (二部图的最大匹配)

The Perfect StallPOJ - 1274Farmer John completed his new barn just last week, complete with all the latest milking technology. Unfortunately, due to engineering problems, all the stalls in the n

2017-11-21 16:00:20 319

原创 106 miles to Chicago SPOJ - CHICAGO(dijkstra)

106 miles to ChicagoSPOJ - CHICAGOIn the movie "Blues Brothers", the orphanage where Elwood and Jake were raised may be sold to the Board of Education if they do not pay 5000 dollars in taxes

2017-11-21 15:57:52 390

原创 畅通工程续 HDU - 1874(dijkstra+坑爹)

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

2017-11-21 15:55:17 370

原创 In 7-bit ZOJ - 3713(进制操作转换)

In 7-bitZOJ - 3713Very often, especially in programming contests, we treat a sequence of non-whitespace characters as a string. But sometimes, a string may contain whitespace characters or

2017-11-17 15:39:54 288

原创 Friends ZOJ - 3710(暴力)

Friends ZOJ - 3710 Alice lives in the country where people like to make friends. The friendship is bidirectional and if any two person have no less than k friends in common, they will be

2017-11-17 10:46:55 298

转载 博弈论模板

博弈论(巴什博奕,威佐夫博弈,尼姆博弈,斐波那契博弈)原博客地址一.  巴什博奕(Bash Game):  A和B一块报数,每人每次报最少1个,最多报4个,看谁先报到30。这应该是最古老的关于巴什博奕的游戏了吧。其实如果知道原理,这游戏一点运气成分都没有,只和先手后手有关,比如第一次报数,A报k个数,那么B报5-k个数,那么B报数之后问题就变为,A和B一块报数,看谁先报到2

2017-11-16 16:21:02 409

原创 Good Luck in CET-4 Everybody! HDU - 1847 (巴氏博弈)

Good Luck in CET-4 Everybody! HDU - 1847 大学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和Cici都是如此。当然,作为在考场浸润了十几载的当代大学生,Kiki和Cici更懂得考前的放松,所谓“张弛有道”就是这个意思。这不,Kiki和Cici在每天晚上休息之前都要玩一会儿扑克牌以

2017-11-16 16:13:54 391

原创 Code POJ - 1850 (组合数学)

Code POJ - 1850 Transmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system is that one where a number

2017-11-16 09:32:38 433

原创 Magic Powder - 2 CodeForces - 670D2 (二分)

Magic Powder - 2 CodeForces - 670D2 The term of this problem is the same as the previous one, the only exception — increased restrictions.InputThe first line contains two positive in

2017-11-15 21:29:36 282

原创 Magic Powder - 1 CodeForces - 670D1 (优先队列)

Magic Powder - 1 CodeForces - 670D1 This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single

2017-11-15 21:28:20 366

原创 Cinema CodeForces - 670C (map,一维坐标离散化,排序)

Cinema CodeForces - 670C Moscow is hosting a major international conference, which is attended by nscientists from different countries. Each of the scientists knows exactly one language.

2017-11-15 21:02:18 511

原创 Misha and Changing Handles CodeForces - 501B(map映射)

Misha and Changing HandlesCodeForces - 501BMisha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times.

2017-11-15 20:09:00 284

原创 Cube HDU - 1220(数学)

CubeHDU - 1220Cowl is good at solving math problems. One day a friend asked him such a question: You are given a cube whose edge length is N, it is cut by the planes that was paralleled to

2017-11-15 20:08:24 277

原创 xiaoxin juju needs help HDU - 5651 (有重复的全排列,逆元)

xiaoxin juju needs helpHDU - 5651As we all known, xiaoxin is a brilliant coder. He knew **palindromic** strings when he was only a six grade student at elementry school.This summer he was wo

2017-11-15 20:07:45 332

原创 迷宫城堡 HDU - 1269 (强连通分量模板题)

E - 迷宫城堡HDU - 1269为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N<=10000)和M条通道(M<=100000),每个通道都是单向的,就是说若称某通道连通了A房间和B房间,只说明可以通过这个通道由A房间到达B房间,但并不说明通过它可以由B房间到达A房间。Gardon需要请你写个程序确认一下是否任意两个房间都是相互连通的,即:对于任意的i和j,至

2017-11-14 09:24:57 609

原创 7-25 畅通工程之局部最小花费问题(35 分)(最小生成树问题)

7-25 畅通工程之局部最小花费问题(35 分)某地区经过对城镇交通状况的调查,得到现有城镇间快速道路的统计数据,并提出“畅通工程”的目标:使整个地区任何两个城镇间都可以实现快速交通(但不一定有直接的快速道路相连,只要互相间接通过快速路可达即可)。现得到城镇道路统计表,表中列出了任意两城镇间修建快速路的费用,以及该道路是否已经修通的状态。现请你编写程序,计算出全地区畅通需要的最低成

2017-11-14 09:18:16 3673 1

原创 7-22 朋友圈(25 分) (并查集)

7-22 朋友圈(25 分)某学校有N个学生,形成M个俱乐部。每个俱乐部里的学生有着一定相似的兴趣爱好,形成一个朋友圈。一个学生可以同时属于若干个不同的俱乐部。根据“我的朋友的朋友也是我的朋友”这个推论可以得出,如果A和B是朋友,且B和C是朋友,则A和C也是朋友。请编写程序计算最大朋友圈中有多少人。输入格式:输入的第一行包含两个正整数N(≤30000)和M(≤1000),分

2017-11-14 09:16:41 779

原创 7-21 Hashing(25 分)

7-21 Hashing(25 分)The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is def

2017-11-14 09:13:28 1284 4

原创 7-20 电话聊天狂人(25 分) (哈希)

7-20 电话聊天狂人(25 分)给定大量手机用户通话记录,找出其中通话次数最多的聊天狂人。输入格式:输入首先给出正整数N(≤10​5​​),为通话记录条数。随后N行,每行给出一条通话记录。简单起见,这里只列出拨出方和接收方的11位数字构成的手机号码,其中以空格分隔。输出格式:在一行中给出聊天狂人的手机号码及其通话次数,其间以空格分隔。如果这样的人不唯一,则输出狂人

2017-11-14 09:12:03 1074

原创 7-19 PAT Judge(25 分)(结构体排序)

7-19 PAT Judge(25 分)The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.Input Specif

2017-11-14 09:10:10 1413

空空如也

空空如也

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

TA关注的人

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