摘要: 题目: 给出一个图的最短路,求原图最少几条边GraphTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 1695Accepted Submission... 阅读全文
posted @ 2014-06-15 23:38 doubleshik 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 题目大意就是数字中不能出现 62 和4代码:/************************************************************************* > File Name: 2089.cpp > Author: minshik > Cr... 阅读全文
posted @ 2014-05-22 01:22 doubleshik 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 题目:A Simple Problem with IntegersTime Limit:5000MSMemory Limit:131072KTotal Submissions:55817Accepted:16839Case Time Limit:2000MSDescriptionYou haveN... 阅读全文
posted @ 2014-05-05 10:43 doubleshik 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 给出1~N 个点 的距离, 求从1号到N号的次短路, 直接用k短路来做了,,dj会TLE, 用spfa就过了题目:I -RoadblocksTime Limit:2000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusDe... 阅读全文
posted @ 2014-04-30 21:00 doubleshik 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 这道题是给出一个n 求出分子分母 7 #include 8 #include 9 #include10 #include11 #include 12 #include13 #include14 #include15 #include 16 #include 17 using namespace std;18 19 int N;20 21 int print(int au,int ad,int bu,int bd)22 {23 if(ad+bd>N;39 40 cout<<"0/1"<<endl;41 print(0,1,1,1);42 cout 阅读全文
posted @ 2014-02-10 22:39 doubleshik 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 在矩阵中取数字, 要求不能去十字相邻的数字。。 感觉第一次做状态压缩的题目 。。一开始没什么想法就看了别人的解题。用二进制表示一行中元素是否取, 先枚举出一行取的可能性。 dp[i][j] 表示第i行第j种可能性。dp[i][j] = dp[i-1][k]+ tmp;先枚举每一种可能性,然后用for生成一个符合status[j] 的tmp , 然后再枚举每一种可能性 status[k]去和j比较。如果不矛盾,就认为i-1行是k的方案,i行是j的方案, 然后比较dp的大小。最后枚举dp[n][j]出最大值题目:方格取数(1)Time Limit: 10000/5000 MS (Java/Othe 阅读全文
posted @ 2014-02-09 23:14 doubleshik 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 就是给出一些点边关系, 有虫洞的就是负值。 注意普通道路是双向边。。一开始这里建错图了之后处理用了spfa ,类似模板的一道题题目:WormholesTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 26848Accepted: 9669DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one- 阅读全文
posted @ 2014-02-09 20:26 doubleshik 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 就是用floyd求一个点点最短距离然后求个平均值题目:Six Degrees of Cowvin BaconTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2359Accepted: 1116DescriptionThe cows have been making movies lately, so they are ready to play a variant of the famous game "Six Degrees of Kevin Bacon". The game works like this 阅读全文
posted @ 2014-02-06 23:51 doubleshik 阅读(356) 评论(0) 推荐(1) 编辑
摘要: 简单的并查集类似 食物链那道题。 简单一下设a-x, a-y 表示 a属于龙帮和a属于蛇帮,以此来判断从属关系题目:Find them, Catch themTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 27729Accepted: 8453DescriptionThe 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 a 阅读全文
posted @ 2014-02-06 23:24 doubleshik 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 给出n个数字, 对每个 取出每个 ai- aj . 问中位数是什么这道题是二分套二分。。 先二分枚举答案, 然后二分验证假设中位数是xai-aj = x (j 2 #include 3 #include 4 #include 5 using namespace std; 6 #define LL long long 7 #define INF 100000000+10 8 LL n; 9 LL num[100000+10];10 11 bool C(LL x)12 {13 LL cnt =0 ;14 for(int i=0;i=m/2+1)return true;20 ... 阅读全文
posted @ 2014-02-06 21:06 doubleshik 阅读(364) 评论(0) 推荐(0) 编辑