• POJ 3624 Charm Bracelet(01背包裸题)

    时间:2024-05-08 14:41:42

    Charm BraceletTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 38909 Accepted: 16862DescriptionBessie has gone to the mall's jewelry store an...

  • POJ 3624 Charm Bracelet 0-1背包

    时间:2024-05-08 14:35:50

    传送门:http://poj.org/problem?id=3624题目大意:XXX去珠宝店,她需要N件首饰,能带的首饰总重量不超过M,要求不超过M的情况下,使首饰的魔力值(D)最大。0-1背包入门题。可构建状态转移方程:dp [ i ] [ v ]= max ( dp[ i-1 ] [ v ], ...

  • [poj3259]Wormholes(spfa判负环)

    时间:2024-05-08 14:00:24

    题意:有向图判负环。解题关键:spfa算法+hash判负圈。spfa判断负环:若一个点入队次数大于节点数,则存在负环。 两点间如果有最短路,那么每个结点最多经过一次,这条路不超过$n-1$条边。”如果一个结点经过了两次,那么我们走了一个圈。如果这个圈的权为正,显然不划算;如果是负圈,那么最短路不存在...

  • POJ 3259——Wormholes——————【最短路、SPFA、判负环】

    时间:2024-05-08 13:42:41

    WormholesTime Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 3259DescriptionWhile exploring his...

  • POJ 3259 Wormholes(SPFA判负环)

    时间:2024-05-08 13:30:47

    题目链接:http://poj.org/problem?id=3259题目大意是给你n个点,m条双向边,w条负权单向边。问你是否有负环(虫洞)。这个就是spfa判负环的模版题,中间的cnt数组就是记录这个点松弛进队的次数,次数超过点的个数的话,就说明存在负环使其不断松弛。 #include <...

  • Poj 3259 Wormholes(spfa判负环)

    时间:2024-05-08 13:24:52

    Wormholes Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 42366 Accepted: 15560 传送门 Description While exploring his man...

  • poj3259(spfa判负环)

    时间:2024-05-08 13:14:56

    题目连接:http://poj.org/problem?id=3259题意:John的农场里N块地,M条路连接两块地,W个虫洞,虫洞是一条单向路,会在你离开之前把你传送到目的地,就是当你过去的时候时间会倒退Ts。我们的任务是知道会不会在从某块地出发后又回来,看到了离开之前的自己。总的来说,就是看图中...

  • POJ3259(Wormholes) 判断负环

    时间:2024-05-08 12:57:08

    题意:农夫john发现了一些虫洞,虫洞是一种在你到达虫洞之前把你送回目的地的一种方式,FJ的每个农场,由n块土地(编号为1-n),M条路,和W个 虫洞组成,FJ想从一块土地开始,经过若干条路和虫洞,返回到他最初开始走的地方并且时间要在他离开之前,或者恰好等于他离开的时间。把虫洞的时间看成负边权,就是...

  • POJ 3259 Wormholes(最短路,判断有没有负环回路)

    时间:2024-05-07 19:14:22

    WormholesTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 24249 Accepted: 8652DescriptionWhile exploring his many farms, Farmer John has disc...

  • poj 3687(拓扑排序)

    时间:2024-05-06 16:36:12

    http://poj.org/problem?id=3687题意:有一些球他们都有各自的重量,而且每个球的重量都不相同,现在,要给这些球贴标签。如果这些球没有限定条件说是哪个比哪个轻的话,那么默认的前面比后的要请,而且这n个球的重量也正好是分布在1-n这个范围内,现在要你求出他们各自所占的重量。思路...

  • Parity game---poj1733

    时间:2024-05-05 21:17:15

    DescriptionNow and then you play the following game with your friend. Your friend writes down a sequence consisting of zeroes and ones. You choose a c...

  • POJ 2491

    时间:2024-05-05 10:07:29

    #include<iostream>#include<stdio.h>#include<string>#define MAXN 400using namespace std;struct node{    string s1;    string s2;};nod...

  • poj 1383 Labyrinth【迷宫bfs+树的直径】

    时间:2024-05-03 18:33:26

    LabyrinthTime Limit: 2000MS Memory Limit: 32768KTotal Submissions: 4004 Accepted: 1504DescriptionThe northern part of the Pyramid contains a very larg...

  • POJ 1383 Labyrinth (bfs 树的直径)

    时间:2024-05-03 17:44:50

    Labyrinth题目链接:http://acm.hust.edu.cn/vjudge/contest/130510#problem/EDescriptionThe northern part of the Pyramid contains a very large and complicated ...

  • poj 2631 Roads in the North【树的直径裸题】

    时间:2024-05-03 17:39:54

    Roads in the NorthTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2359 Accepted: 1157DescriptionBuilding and maintaining roads among communi...

  • [POJ1222]EXTENDED LIGHTS OUT(高斯消元,异或方程组)

    时间:2024-05-03 17:15:44

    题目链接:http://poj.org/problem?id=1222题意:开关是四连通的,每按一个就会翻转自己以及附近的四个格(假如有)。问需要翻转几个,使他们都变成关。把每一个灯看作一个未知量,可以有30个未知量,给每一个未知量从0~29编号,再列30个方程,每一个方程中描述每一个灯被翻转后其相...

  • POJ3617 Best Cow Line

    时间:2024-05-03 09:41:48

    其实是学习参考了算法书的代码,但仍然是我自己写的,有小差别。贪心类型。 #include <iostream> using namespace std; int main() { int i,n; char str[+]; scanf("%d",&n); ...

  • poj 1270(toposort)

    时间:2024-05-01 07:39:15

    http://poj.org/problem?id=1270题意:给一个字符串,然后再给你一些规则,要你把所有的情况都按照字典序进行输出。思路:很明显这肯定要用到拓扑排序,当然看到discuss里面有些人有bfs也可以做,有时候觉得搜索只要剪枝剪的好,啥都可以用搜索。因为我也不是很会拓扑排序,所以在...

  • poj 3258 River Hopscotch(二分搜索之最大化最小值)

    时间:2024-04-30 11:47:09

    DescriptionEvery year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. T...

  • POJ 1987 BZOJ 3365 Distance Statistics 树的分治(点分治)

    时间:2024-04-28 22:49:13

    题目大意:(同poj1741,刷一赠一系列)CODE:#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#define MAX 40010#define ...