- 博客(65)
- 收藏
- 关注
原创 最短路 模板
http://acm.hdu.edu.cn/showproblem.php?pid=2544在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? Input输入包括多组数据。每组数据第
2015-01-27 20:13:54
494
原创 Given Length and Sum of Digits...---------cf水题
#includeusing namespace std;int aa[3009],n,num=0;int bb[10000], cc[10000];void select_sort(int* a, int n){ int i, j, min, t; for (i = 0; i<n - 1; i++) { min = i;//查找最小值 for (j = i + 1; j<
2014-11-18 20:25:46
760
原创 二叉树-简单-Dropping Balls
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=19499题意:有一个满二叉树
2014-11-01 20:27:52
482
原创 map,队列
#include#include#include#include#include#includeusing namespace std;map >a;//最后两个不要连着写会误认为>>int main(){ freopen("in.txt", "r", stdin); int n, m, x, y; while (scanf("%d%d", &n, &m) == 2) {
2014-10-08 21:27:25
585
原创 set---Andy's First Dictionary
#include#include#include#include#include#include#include#includeusing namespace std;setdict;int main(){ string s, buf; while (cin >> s) { for (int i = 0; i < s.length(); i++) {
2014-09-24 20:27:48
441
原创 vector-- The Blocks Problem
#include#include#include#includeusing namespace std;const int maxn=30;int n;vector pile[maxn];//每个pile【i】是一个vector//找木块a所在的pile和height,以引用的形式返回调用者void find_block(int a,int& p,int& h){ for(p
2014-09-22 21:31:58
376
原创 sort--uva10474
#include#includeusing namespace std;int a[100000];int b[100000];int main(){ int n,m; int num=0; //freopen("in.txt","r",stdin); while(cin>>n>>m) { if(n==0&&m==0) break; for(int i=0
2014-09-22 19:58:14
295
原创 Ananagrams ---map的使用
Ananagrams Most crossword puzzle fans are used to anagrams--groups of words with the same letters in different orders--for example OPTS, SPOT, STOP, POTS and POST. Some words however d
2014-09-21 21:33:11
395
原创 Appleman and Easy Task-cf
#includeusing namespace std;char a[200][200];int vis[200][200];int n;int dfs(int i, int j){ int num = 0; if (a[i - 1][j] == 'o'&&i>0 && i 0) num++; if (a[i][j - 1] == 'o'&&i>0 && i 0) num
2014-08-29 15:28:49
430
原创 DFS------Lake Counting
http://poj.org/problem?id=2386Lake CountingTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 20206 Accepted: 10182DescriptionDue to recent rains
2014-08-17 09:35:38
383
原创 Air Raid
Air RaidTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 6636 Accepted: 3953DescriptionConsider a town where all the streets are one-way and each stree
2014-08-09 20:09:54
607
原创 Shortest Prefixes
Shortest PrefixesTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 13321 Accepted: 5755DescriptionA prefix of a string is a substring starting at the be
2014-08-02 15:44:17
425
原创 trie树
描述小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。这一天,他们遇到了一本词典,于是小Hi就向小Ho提出了那个经典的问题:“小Ho,你能不能对于每一个我给出的字符串,都在这个词典里面找到以这个字符串开头的所有单词呢?”身经百战的小Ho答道:“怎么会不能呢!你每给我一个字符串,我就依次遍历词典里的所有单词,检查你给
2014-08-01 21:27:03
320
原创 ZOJ 3603 Draw Something Cheat
Have you played Draw Something? It's currently one of the hottest social drawing games on Apple iOS and Android Devices! In this game, you and your friend play in turn. You need to pick a word and dra
2014-07-30 21:50:50
401
原创 Shortest Prefixes
#include#include #include #include using namespace std;char str[1000][30],res[1000][30];struct node{ struct node *next[26];//字母分支 int flag;}node;struct node *root;//根节点void inset_tree(c
2014-07-30 09:27:01
358
原创 TIANKENG’s restaurant
bchttp://acm.hdu.edu.cn/showproblem.php?pid=4883TIANKENG’s restaurantTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 379 Accep
2014-07-28 15:02:17
404
原创 线段树,最大最小值
Balanced LineupTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 33762 Accepted: 15872Case Time Limit: 2000MSDescriptionFor the daily milking, Far
2014-07-27 18:15:27
534
原创 Aggressive cows
Aggressive cowsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5996 Accepted: 2986DescriptionFarmer John has built a new long barn, with N (2 His
2014-07-26 09:15:09
617
原创 二分
#include#includeusing namespace std;int n,key;double a[10009];bool satisfied(double x){ int num=0; for(int i=0;i<n;i++) num+=(int)(a[i]/x); //cout<<num<<endl; return num>=key;}int main()
2014-07-25 20:07:51
340
原创 Expedition
http://poj.org/problem?id=2431ExpeditionTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6640 Accepted: 1989DescriptionA group of cows
2014-07-23 14:19:47
397
原创 ZOJ 3787 Access System 模拟
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3787
2014-07-22 16:47:38
555
原创 小希的迷宫
http://acm.hdu.edu.cn/showproblem.php?pid=1272Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走
2014-07-21 16:31:22
425
原创 并查集
#include #include #include #include using namespace std; int m,n,parent[20000];void UFset()//初始化{ for(int i=1;i<=m;i++) parent[i]=-1;}int Find(int x){ int s;//查找位置,一直找到parent[s]
2014-07-16 20:17:19
299
原创 poj 滑雪
滑雪Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 74621 Accepted: 27643DescriptionMichael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或
2014-07-15 20:19:43
470
原创 完全背包
完全背包Problem Description在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法。请你编程序计算出共有多少种兑法。 Input每行只有一个正整数N,N小于32768。 Output对应每个输入,输出兑换方法数。 Sample Input293412
2014-07-15 09:32:58
278
原创 嵌套矩形
#include#include#includeusing namespace std;struct k{ int a,b;}aa[2009];int cmp(k i,k j){ if(i.a==j.a) return i.b<j.b; else return i.a<j.a;}int n,x,y,dp[2009];int main(){ int N; ci
2014-07-14 10:49:25
380
原创 01背包
https://vijos.org/p/1104采药Wrong Answer标签:动态规划 背包NOIP普及组2005描述辰辰是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师。为此,他想拜附近最有威望的医师为师。医师为了判断他的资质,给他出了一个难题。医师把他带到一个到处都是草药的山洞里对他说:“孩子,这个山洞里有一些不同的草
2014-07-09 14:45:38
321
原创 笨笨的导弹攻击
笨笨的导弹攻击Accepted标签:动态规划动态规划 LIS笨笨工作室系列背景在那遥远的地方,有个小目标~~笨笨:导弹准备!路人甲:(这么小个目标都要欺负……)老大,导弹只有一部分可以用……笨笨:不管那么多,有多少就打多少!描述为了彻底打击目标,笨笨要使用足够多的导弹去打击目
2014-07-09 14:24:50
715
原创 雷曼兔(csapc)
这里算不上dp吧.直接设置P1474雷曼兔(csapc)未递交标签:动态规划 LIScsapc描述这次,OI山成为了雷曼兔那无尽的冒险传说的新舞台!传说OI山中埋藏着巨大的宝藏,伴随着这个传说的是一个迷题:最瑰丽的舞者将达至精灵世界的彼岸……经过仔细推敲,雷曼兔发现这是一个提示宝藏埋藏位置的谜语,在该谜语中指出了一个特定的路径,只有经
2014-07-08 20:57:58
1123
原创 距离.............
P1680距离Accepted标签:动态规划动态规划 LCS背景简单的DP描述设有字符串X,我们称在X的头尾及中间插入任意多个空格后构成的新字符串为X的扩展串,如字符串X为”abcbcd”,则字符串“abcb_c_”,“_a_bcbcd_”和“abcb_c_”都是X的扩展串,这里“_”代
2014-07-08 09:14:14
548
原创 魔族密码
描述风之子刚走进他的考场,就……花花:当当当当~~偶是魅力女皇——花花!!^^(华丽出场,礼炮,鲜花)风之子:我呕……(杀死人的眼神)快说题目!否则……-_-###花花:……咦~~好冷~~我们现在要解决的是魔族的密码问题(自我陶醉:搞不好魔族里面还会有人用密码给我和菜虫写情书咧,哦活活,当然是给我的比较多拉*^_^*)。魔族现在使用一种新型的密码系统。每一个密码都是一个给定的仅
2014-07-07 09:06:24
709
原创 神秘的咒语 LCIS
身为拜月教的高级间谍,你的任务总是逼迫你出生入死。比如这一次,拜月教主就派你跟踪赵灵儿一行,潜入试炼窟底。据说试炼窟底藏着五行法术的最高法术:风神,雷神,雪妖,火神,山神的咒语。为了习得这些法术,要付出艰辛的努力,但是回报同样十分丰厚。拜月希望你告诉他咒语的长度为多少。(你:“请问您想知道咒语的具体内容吗?”拜月:“想,但是vijos不支持special judge。”-_-原来大人物也有
2014-07-06 09:25:50
1168
原创 最长上升子序列
#includeusing namespace std;int main(){ long long a[1009],f[1009],s[1009],n; while(cin>>n) { if(n==0) break; for(int i=1;i<=n;i++) { cin>>a[i]; } f[1]=a[1]; s[1]=1; for(int i
2014-07-05 15:55:36
384
原创 数根
http://210.38.224.114:808/JudgeOnline/problem.php?id=1084Description数根可以通过把一个数的各个位上的数字加起来得到。如果得到的数是一位数,那么这个数就是数根。如果结果是两位数或者包括更多位的数字,那么再把这些数字加起来。如此进行下去,直到得到是一位数为止。 比如,对于24来说,把2和4相加得到6,由于6
2014-06-26 13:44:24
1207
原创 “塔康”导航系统
asin()塔康”(TACAN-Tactical Air Navigation System)是战术空中导航系统的简称,由美国于1955年研制成功,后被法国、德国、英国、加拿大、日本、韩国等广泛使用。主要用于为舰载机提供从几十千米到几百千米距离范围内的导航,保障飞机按预定航线飞向目标,机群的空中集结,以及在复杂气象条件下引导飞机归航和进场等。这是一种极坐标无线电空中导航系统
2014-06-21 20:44:48
4709
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人