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

  • POJ 1743 Musical Theme (字符串HASH+二分)

    时间:2024-04-28 16:20:19

    Musical ThemeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 15900 Accepted: 5494DescriptionA musical melody is represented as a sequence of...

  • POJ 2837 Til the Cows Come Home

    时间:2024-04-28 15:57:54

    Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 45515 Accepted: 15434DescriptionBessie is out in the field and wants to get back to the barn...

  • Backward Digit Sums(POJ 3187)

    时间:2024-04-28 15:41:39

    Backward Digit SumsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5495 Accepted: 3184DescriptionFJ and his cows enjoy playing a mental game...

  • 【POJ】1830 开关问题(高斯消元)

    时间:2024-04-28 15:35:08

    http://poj.org/problem?id=1830高斯消元无解的条件:当存在非法的左式=0而右式不等于0的情况,即为非法。这个可以在消元后,对没有使用过的方程验证是否右式不等于0(此时因为前边消元一定会使得后边的方程左式为0)高斯消元自由变元:自由变元就是当这些未知量一旦确定,整个方程就确...

  • poj 1091 跳蚤

    时间:2024-04-28 14:41:55

    跳蚤Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 8482 Accepted: 2514DescriptionZ城市居住着很多只跳蚤。在Z城市周六生活频道有一个娱乐节目。一只跳蚤将被请上一个高空钢丝的正中央。钢丝很长,可以看作是无...

  • POJ2115 C Looooops(线性同余方程)

    时间:2024-04-28 08:20:29

    无符号k位数溢出就相当于mod 2k,然后设循环x次A等于B,就可以列出方程:$$ Cx+A \equiv B \pmod {2^k} $$ $$ Cx \equiv B-A \pmod {2^k} $$最后就用扩展欧几里得算法求出这个线性同余方程的最小非负整数解。 #include<cstd...