- 博客(24)
- 收藏
- 关注
原创 AC自动机
POJ 2778DNA SequenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 14182 Accepted: 5469DescriptionIt's well known that DNA Sequence is a seque
2016-02-20 22:17:15
348
原创 字典树
POJ 2503BabelfishTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 38424 Accepted: 16392DescriptionYou have just moved from Waterloo to a big city
2016-02-20 22:13:56
293
原创 KMP 算法
POJ 2752Seek the Name, Seek the FameTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 15528 Accepted: 7856DescriptionThe little cat is so famous,
2016-02-20 22:11:49
294
原创 费用流解决最优匹配 PKU3686
The Windy'sTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 4774 Accepted: 2007DescriptionThe Windy's is a world famous toy factory that owns M top-class
2016-02-20 22:08:43
307
原创 Prim算法求最小生成树 poj 1258
Agri-NetTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 47993 Accepted: 19880DescriptionFarmer John has been elected mayor of his town! One of his campa
2016-02-20 22:03:52
370
原创 Dijkstra算法求最短路
Heavy TransportationTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 26760 Accepted: 7148DescriptionBackground Hugo Heavy is happy. After the breakdown
2016-02-20 22:00:23
242
原创 广度优先搜索
Catch That CowTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 67577 Accepted: 21286DescriptionFarmer John has been informed of the location of a fugitiv
2016-02-20 21:55:58
244
原创 九数组分数
九数组分数1,2,3...9 这九个数字组成一个分数,其值恰好为1/3,如何组法?下面的程序实现了该功能,请填写划线部分缺失的代码。#include void test(int x[]){int a = x[0]*1000 + x[1]*100 + x[2]*10 + x[3];int b = x[4]*10000 + x[5]*1000
2016-02-20 21:38:08
317
原创 格子中输出
格子中输出StringInGrid函数会在一个指定大小的格子中打印指定的字符串。要求字符串在水平、垂直两个方向上都居中。如果字符串太长,就截断。如果不能恰好居中,可以稍稍偏左或者偏上一点。下面的程序实现这个逻辑,请填写划线部分缺少的代码。#include #include void StringInGrid(int width, in
2016-02-20 21:15:01
254
原创 三样献瑞
3.问题描述:三羊献瑞观察下面的加法算式: 祥 瑞 生 辉 + 三 羊 献 瑞------------------- 三 羊 生 瑞 气其中,相同的汉字代表相同的数字,不同的汉字代表不同的数字。请你填写“三羊献瑞”所代表的4位数字(答案唯一),不要填写任何多余内容。思路:看到此题,第一反应便是有多少个不同的字便用几重循环来控制
2016-02-20 20:41:34
398
原创 奖券数目
1.问题描述:奖券数目有些人很迷信数字,比如带“4”的数字,认为和“死”谐音,就觉得不吉利。虽然这些说法纯属无稽之谈,但有时还要迎合大众的需求。某抽奖活动的奖券号码是5位数(10000-99999),要求其中不要出现带“4”的号码,主办单位请你计算一下,如果任何两张奖券不重号,最多可发出奖券多少张。请提交该数字(一个整数),不要写任何多余的内容或说明性文字。
2016-02-20 18:36:20
675
原创 深度优先搜索
Sticks poj 1011DescriptionGeorge took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he
2016-02-20 16:34:44
210
原创 树状数组
Stars poj 2352DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of
2016-02-20 14:54:22
270
原创 并查集
poj 1703 Find them,Catch themDescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. Ho
2016-02-19 21:41:15
259
原创 丢失的数字
注意重复的~~#include #include"cstdio"#include"cstring"using namespace std;int a[100001];int main(){ int i,n,m,r; while(~scanf("%d%d",&n,&m)) { memset(a,0,sizeof(a)); for
2015-12-04 13:50:51
424
原创 hdu5586 Sum(dp)
题意:#include"iostream"#include"cstdio"#include"cstring"using namespace std;int f(int x){ return (1890*x+143)%10007-x;}int b[100005],a[100005];int main(){ int n,i; while(~scan
2015-12-02 12:23:03
256
原创 poj 2409 polya原理
题意: let is bead (POJ 2409)一串由n个珠子组成的项链,用c种颜色涂染,问能形成多少种不同项链?由旋转和翻转得来的算同一种。思路:用polya 定理解决这个计数问题,关键是分析群中置换的个数和每个置换的循环节个数,分析题目中的两种置换群,一种是旋转置换,一种是翻转置换。#include"iostream"#include"cstdio
2015-12-02 11:08:36
768
原创 hdu 5563 (判定正五角星)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=5563#include"iostream"#include"cstdio"#include"cmath"using namespace std;typedef struct {double x,y;}point;double d(point &p1,point &p2){ double
2015-11-29 22:17:52
303
原创 hdu 5585 Numbers(字符串模拟大数)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=5585#include #include"cstring"using namespace std;int main(){ char str[31]; int length; bool flag; while(cin.getline(str+1,30)) {
2015-11-29 22:11:00
244
原创 Poj 1006 中国剩余定理
Description人生来就有三个生理周期, 分别为体力、感情和智力周期,它们的周期长度为23天、28天和33天。每一个周期中有一天是高峰。在高峰这天,人会在相应的方面表现出色。例如,智力周 期的高峰,人会思维敏捷,精力容易高度集中。因为三个周期的周长不同,所以通常三个周期的高峰不会落在同一天。对于每个人,我们想知道何时三个高峰落在同 一天。对于每个周期,我们会给出从当前年份的第一天开始,到
2015-11-21 22:13:36
269
原创 POJ2407 欧拉函数
Relatives( POJ2407) 给出n(n求小于等于n且与n互质的元素个数。 思路:欧拉函数解决 #include"iostream" #include"cstdio"#include"cmath"using namespace std;typedef long long LL;int main(){ LL n,res; w
2015-11-21 22:09:45
309
原创 Poj 1061 青蛙的约会(扩展欧几里得)
两个青蛙在赤道上跳跃,走环路。起始位置分别为x,y。每次跳跃距离分别为m,n。赤道长度为L。两青蛙跳跃方向与次数相同的情况下,问两青蛙是否有方法跳跃到同一点。输出最少跳跃次数。 Input 输入只包括一行5个整数x,y,m,n,L,其中x≠y ,0 、n ,0 。 Output 输出碰面所需要的跳跃次数,如果永远不可能碰面则输出一行"Impossible"S
2015-11-21 22:06:48
230
原创 poj 1811
例4-7 Prime( POJ1811)给出一个数N(N,若它是素数,输出“Prime”,否则输出他的最小质因数。解题思路:数据范围大,用M-R算法进行素数判断,用Pollard_Rho法进行大数分解。#include"stdio.h"#include"stdlib.h"#include"iostream"#include"ctime"using namespace std
2015-11-21 21:46:27
267
原创 poj2010
#include"iostream"#include"cstdio"#include"queue"#include"algorithm"using namespace std;struct Cow{int s,f;}cow[101000];bool cmp(const Cow &a,const Cow &b){ if(a.s!=b.s) return a.s>b
2015-11-17 21:53:00
311
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人