随笔分类 -  POJ

摘要:问题便转化为:给定一个图,是否存在“一笔画”经过涂中每一点,以及经过每一边一次。这样就是求图中是否存在欧拉路Euler-Path。由图论知识可以知道,无向图存在欧拉路的充要条件为:① 图是连通的;② 所有节点的度为偶数,或者有且只有两个度为奇数的节点。 trie 和 并查集 样本输入 阅读全文
posted @ 2016-09-22 15:27 海上的风 阅读(239) 评论(0) 推荐(0) 编辑
摘要:枚举两个点作为一条边,求出正方形的另外两个点,利用hash查找另外两个点。 1 #include 2 #include 3 #include 4 struct node{ 5 int x,y; 6 } point[1002]; 7 8 struct hash{ 9 int pos;... 阅读全文
posted @ 2015-12-18 20:22 海上的风 阅读(177) 评论(0) 推荐(0) 编辑
摘要:题意:对于方程:a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0 ,有xi∈[-50,50], xi != 0, any i∈{1,2,3,4,5}. 现在给出a1,a2,a3,a4,a5的值,求出满足上面方程的解有多少个。思路:hash的应用。暴力枚举的话会达到100^5,明... 阅读全文
posted @ 2015-08-10 11:02 海上的风 阅读(295) 评论(0) 推荐(0) 编辑
摘要:有 T(1 2 #include 3 #include 4 int M,T,N; 5 double p[1002][32]; 6 double dp[1002][32][32]; 7 double sum[1002][32]; 8 int main() { 9 scanf("%d %d %d... 阅读全文
posted @ 2015-08-08 10:58 海上的风 阅读(285) 评论(0) 推荐(0) 编辑
摘要:这题,看到别人的解题报告做出来的,分析:大概意思就是:数组sum[i][j]表示从第1到第i头cow属性j的出现次数。所以题目要求等价为:求满足sum[i][0]-sum[j][0]=sum[i][1]-sum[j][1]=.....=sum[i][k-1]-sum[j][k-1] (j1 1 16... 阅读全文
posted @ 2015-08-07 10:35 海上的风 阅读(317) 评论(0) 推荐(0) 编辑
摘要:判断n朵雪花中,是否有完全一样的雪花。简单的hash,将雪花的六个边的权值加起来,记为sum,将sum相等的雪花归为一类,再在这里面根据题意找完全相同的,判断顺时针或者逆时针的所有角是否一模一样。#include#includeint MOD=19999;std::vector snow[20000... 阅读全文
posted @ 2015-08-06 12:27 海上的风 阅读(627) 评论(0) 推荐(0) 编辑
摘要:利用归并排序统计逆序数,利用归并求逆序在对子序列s1和s2在归并时(s1,s2已经排好序),若s1[i]>s2[j](逆序状况),则逆序数加上s1.length-i,因为s1中i后面的数字对于s2[j]都是逆序的。 1 #include 2 #include 3 int N; 4 int num... 阅读全文
posted @ 2015-08-05 10:02 海上的风 阅读(229) 评论(0) 推荐(0) 编辑
摘要:题意;寻找中位数利用快速排序来寻找中位数。 1 #include 2 using namespace std; 3 int N; 4 int op[10000]; 5 int Median(int left,int right,int pos){ 6 int l=left-1,r=left... 阅读全文
posted @ 2015-08-03 11:47 海上的风 阅读(479) 评论(0) 推荐(0) 编辑
摘要:字符串子序列查找问题,设置两个指针,一个指向子序列,另一个指向待查找的序列,查找个字符串一次即可判断。 1 #include 2 #include 3 using namespace std; 4 char s[100002]; 5 char t[100002]; 6 int main() { ... 阅读全文
posted @ 2015-08-01 10:20 海上的风 阅读(235) 评论(0) 推荐(0) 编辑
摘要:大致题意: 给出n个长度为60的DNA基因(A腺嘌呤 G鸟嘌呤 T胸腺嘧啶 C胞嘧啶)序列,求出他们的最长公共子序列使用后缀数组解决 1 #include 2 #include 3 char str[6200],res[6200]; 4 int num[6200],loc[6200]; ... 阅读全文
posted @ 2015-07-31 10:10 海上的风 阅读(192) 评论(0) 推荐(0) 编辑
摘要:Time Limit:2000MSMemory Limit:65536KTotal Submissions:22541Accepted:8220DescriptionYou, as a member of a development team for a new spell checking pro... 阅读全文
posted @ 2015-07-29 12:29 海上的风 阅读(243) 评论(0) 推荐(0) 编辑
摘要:Time Limit:2000MSMemory Limit:32768KTotal Submissions:24788Accepted:12922DescriptionA power network consists of nodes (power stations, consumers and d... 阅读全文
posted @ 2015-07-28 13:52 海上的风 阅读(207) 评论(0) 推荐(0) 编辑
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:5949Accepted:2053Special JudgeDescriptionAs you know, all the computers used for ACM contests mu... 阅读全文
posted @ 2015-07-27 15:16 海上的风 阅读(219) 评论(0) 推荐(0) 编辑
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:17258Accepted:9386DescriptionBessie wants to navigate her spaceship through a dangerous asteroid... 阅读全文
posted @ 2015-07-26 10:11 海上的风 阅读(176) 评论(0) 推荐(0) 编辑
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:29855Accepted:10341DescriptionAn ascending sorted sequence of distinct values is one in which so... 阅读全文
posted @ 2015-07-23 09:19 海上的风 阅读(172) 评论(0) 推荐(0) 编辑
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:9821Accepted:3283DescriptionThe Borg is an immensely powerful race of enhanced humanoids from th... 阅读全文
posted @ 2015-07-21 12:59 海上的风 阅读(297) 评论(0) 推荐(0) 编辑
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:44373Accepted:18127DescriptionFarmer John has been elected mayor of his town! One of his campaig... 阅读全文
posted @ 2015-07-20 10:58 海上的风 阅读(172) 评论(0) 推荐(0) 编辑
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:24383Accepted:11243DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Fl... 阅读全文
posted @ 2015-07-17 10:28 海上的风 阅读(234) 评论(0) 推荐(0) 编辑
摘要:Time Limit:2000MSMemory Limit:65536KTotal Submissions:20884Accepted:8075DescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types. Some ... 阅读全文
posted @ 2015-07-15 21:07 海上的风 阅读(215) 评论(0) 推荐(0) 编辑
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:17374Accepted:7312DescriptionArbitrage is the use of discrepancies in currency exchange rates to... 阅读全文
posted @ 2015-07-12 22:17 海上的风 阅读(324) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示