自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

loving coding

热爱现在的生活

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

原创 HDU 3722 Card Game 【KM】

Jimmy invents an interesting card game. There are N cards, each of which contains a string Si. Jimmy wants to stick them into several circles, and each card belongs to one circle exactly. When stick...

2018-05-16 16:45:15 369

原创 hdu 1215 七夕节【求n的因子和】

题意:输入t,再输入t个数,求每个数n的因子和(1<=N<=500000)思路:素数筛法的应用#include<stdio.h> #include<string.h> const int maxn = 500010; int vis[maxn]; int main() { int n,t,i,j; memset(vis,0,sizeof(vis)); f...

2018-05-16 12:47:40 205

原创 ZZNUoj 2094 : 正约数之和【n!的因子和】

题目描述我们把f(i)表示为i的正约数的和,而我们要求的是1<=i<=n之间所有i的f(i)之和!输入先输入一个正整数T,表示T个这是数据。T(T<=50)每行输入一个正整数n。(n<10^6)输出输出一个数字,表示所求的数。样例输入复制3 5 12 2018样例输出复制21 127 3350309题意:求n!的因子数之和。思路:累加n中存在的n/i个以i为因子的数的因子i...

2018-05-16 12:39:40 556

原创 zoj 3878 Convert QWERTY to Dvorak 【模拟】

Edward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY Keyboard with a broken Caps Lock key, so Edward never presses the broken Caps Lock key. Luckily, all the oth...

2018-05-16 09:09:27 229

原创 poj The Unique MST【判断唯一最小生成树】

DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique.Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a su...

2018-05-15 17:44:41 392

原创 poj 3962 Kindergarten 【二分匹配最大团问题】

In a kindergarten, there are a lot of kids. All girls of the kids know each other and all boys also know each other. In addition to that, some girls and boys know each other. Now the teachers want t...

2018-05-15 14:54:24 218

原创 hdu 1867 A + B for you again【KMP】【判断前后缀】

Generally speaking, there are a lot of problems about strings processing. Now you encounter another such problem. If you get two strings, such as “asdf” and “sdfg”, the result of the addition betwee...

2018-05-15 11:28:32 194

原创 poj1797 Heavy Transportation 【dijstra变形】 + HDU1010 Tempter of the Bone【DFS奇偶剪枝】

Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way fro...

2018-05-15 00:56:44 241 1

原创 hdu 3371 Connect the cities【最小生成树】

In 2100, since the sea level rise, most of the cities disappear. Though some survived cities are still connected with others, but most of them become disconnected. The government wants to build some...

2018-05-14 20:57:56 148

原创 A.挑战密室 河南省第八届ACM 【模拟】

问题 : A.挑战密室时间限制: 1 Sec  内存限制: 128 MB提交: 12  解决: 7[提交][状态]题目描述 R组织的特工Dr. Kong 为了寻找丢失的超体元素,不幸陷入WTO密室。Dr. Kong必须尽快找到解锁密码逃离,否则几分钟之后,WTO密室即将爆炸。   Dr. Kong发现密室的墙上写了许多化学方程式中。化学方程式,也称为化学反应方程式,是用化学式表示物质化学反应的式子...

2018-05-11 20:32:37 205

原创 HDU 5115 M - Dire Wolf 【区间dp】

Dire wolves, also known as Dark wolves, are extraordinarily large and powerful wolves. Many, if not all, Dire Wolves appear to originate from Draenor. Dire wolves look like normal wolves, but thes...

2018-05-11 00:18:47 146

原创 NYoj 1237-最大岛屿 【输入带坑的DFS】

题目描述: 神秘的海洋,惊险的探险之路,打捞海底宝藏,激烈的海战,海盗劫富等等。加勒比海盗,你知道吧?杰克船长驾驶着自己的的战船黑珍珠1号要征服各个海岛的海盜,最后成为海盗王。 ...

2018-05-10 23:35:59 360

原创 区间DP入门学习

区间DP,区间上做动态规划。一个大区间必然由长度不等的小区间合并而来,在合并过程中,最基本也是动态规划的必须原则:满足最优化原理和无后效性原则,所以在确定状态转移方程时,得特别留心这两点。区间DP区别于其它线性DP题的特点是:区间DP通过枚举区间分界点实现状态转移。词穷了,还是写题来感受吧~~,有坑自己再补上。入门题1:凸多边形三角划分题意:给定一个具有N(N<=50)个顶点的凸多边形,每个...

2018-05-09 23:58:27 799

原创 uva 11882 C - Biggest Number 【最优性剪枝】【深搜】

题意:给定一个n*m的矩阵,'#'表示不能通过,每个方格只能走过一次且下一步只能走上下左右四个方向,问,能够组成最大连续的数字为多大?思路:最优性剪枝即当前所搜索到的结点的后续最优情况也不比当前最优情况好,就停止对当前结点的搜索,回溯到其父亲结点,搜索其它情况。这里用到了两个剪枝,一个是当前已搜索到的数字长度+后续能搜索到的数字长度小于最优值时,直接剪枝;另一个是长度相等时,判断字典序大小,前者较...

2018-05-08 15:38:32 448

原创 N - Network UVALive - 3902 【链式前向星应用】

之前写过这道题目的博客,用c++实现的前向星博客地址~~感觉自己不是很理解vector的存储方式,所以用结构体去存图(没有学过c++,所以不敢轻易用自己不熟悉的东西),结果WA,后来在和大佬的沟通中才知道原来这是用vector去实现的前向星(以存储边的方式存储图),百度找了下链式前向星,自己理解之后,终于把这道题用自己喜欢的方式写过了~~撒花~~#include<stdio.h> #i...

2018-05-07 09:57:06 154

原创 zoj 3960 M - What Kind of Friends Are You? 【哈希】or【map+vector】

Japari Park is a large zoo home to extant species, endangered species, extinct species, cryptids and some legendary creatures. Due to a mysterious substance known as Sandstar, all the animals have bec...

2018-05-06 20:57:12 226

原创 poj 2349 K - Arctic Network 【最小生成树prime】

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

2018-05-06 11:57:30 226

原创 zoj 4035 J - Doki Doki Literature Club【优先队列+map】

Doki Doki Literature Club! is a visual novel developed by Team Salvato. The protagonist is invited by his childhood friend, Sayori, to join their high school's literature club. The protagonist then me...

2018-05-05 17:20:43 446

原创 hdu 1874 C - 畅通工程续 【spfa + 邻接表】

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

2018-05-04 20:51:10 237

原创 河南省第九届大学生程序设计竞赛 问题 : 信道安全 【spfa+邻接表】

题目描述Alpha 机构有自己的一套网络系统进行信息传送。情报员 A 位于节点 1,他准备将一份情报发送给位于节点 n 的情报部门。可是由于最近国际纷争,战事不断,很多信道都有可能被遭到监视或破坏。经过测试分析,Alpha 情报系统获得了网络中每段信道安全可靠性的概率,情报员 A 决定选择一条安全性最高,即概率最大的信道路径进行发送情报。你能帮情报员 A 找到这条信道路径吗?输入第一行: T 表示...

2018-05-03 20:58:01 171

原创 uva 3177 A - Beijing Guards 【贪心+二分】

题意:给定n个数,表示每个人想要的礼物种类,相邻的人礼物种类不能有重复的礼物种类,1和n相邻问,最少需要多少种类的礼物才能满足所有人的要求思路:二分构造。自己只想到了偶数的情况下,最少需要的礼物数是相邻值最大的和奇数情况下,分配策略是,编号为偶数的人,尽量取种类编号靠前的数,编号为奇数的人,尽量取种类编号靠后的数。奇数情况我始终想不出来,而lrj的训练指南说:"不难发现,最优的分配策略是...",...

2018-05-03 13:11:35 148

原创 uva 3971 D - Assemble【二分枚举查找】

题意:给定n个配件的类型,名字,价格和品质因子,每种类型的配件各选一个 问在b元的预算下,找到最小品质因子的最大值(最小品质因子指选出的配件都大于该品质因子) 思路:找到所有配件中的最大品质因子,再二分枚举查找最小品质因子在每种类型的配件中查找所有品质因子大于枚举值q的最小价格,计入预算如果预算超出b,说明该枚举值q不满足条件,如果满足预算,则右移继续查找,直到跳出循环 #include<...

2018-05-03 12:27:54 138

原创 uva 11384 C - Help is needed for Dexter【规律】

题意:输入n,表示有1~n个数,任意选定一个数number,则可以将所有大于等于该数的所有数减去number,问最小需要多少步能将所有数减为0.思路:找规律。比如n=5.1,2,3,4,5  都减去3以后为{1,2,0,1,2},这时候就相当于求n=2时的最小步数。即f(5) = f(2) + 1.#include<stdio.h> int dfs(int n) { if(n == ...

2018-05-02 20:42:24 459

原创 uva 11464 B - Even Parity 【二进制枚举】

题意:给定一个n*n的矩阵,由0 1组成,每次操作可以将0变成1,问,最少需要多少次操作可以使每个数周围数之和为偶数。思路:枚举第一行可能有的所有情况,再根据每种情况计算出剩下行的排列存入临时数组,每次操作之和就是临时数组和原数组不同的值总和,取所有情况之和中的最小值输出即可。#include<stdio.h> #include<string.h> #include<...

2018-05-02 17:41:28 183

原创 山东省第一届ACM大学生程序设计竞赛Emergency【Floyd变形】

题目描述Kudo’s real name is not Kudo. Her name is Kudryavka Anatolyevna Strugatskia, and Kudo is only her nickname.Now, she is facing an emergency in her hometown:Her mother is developing a new kind of sp...

2018-05-02 14:01:04 270

空空如也

空空如也

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

TA关注的人

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