- 博客(27)
- 资源 (1)
- 收藏
- 关注
原创 uva Euclidean TSP (三分)
Euclidean TSP题目很难懂,就是给出两个公式,求c的最小值,有于关于c的函数单调性不是在1-100内单调的,所以不能用二分来逼近c的,所以就有了三分法(参考博客)利用三分来逼近最小值#include #include #include #include #include #include #include #include #include usi
2017-02-23 11:12:19 519
原创 uva Finding Lines
Finding Lines题目大意:给你n个点和一个概率,再给出n个坐标,问任意两点构成的直线,这条直线包含的点的个数比上n大于等于这个概率就输出possible,否则输出impossible。解题思路:n的范围是10的5次方,时间是20000毫秒,暴力枚举的时间复杂度是O(n^3),最大是10的15次方。所以枚举存在问题。于是就采用随机枚举的办法,写个随机数生产器,随机出1000(也可以
2017-02-23 08:42:15 283
原创 UVALive - 6952 (隔板dp)
UVALive - 6952 题目大意:超市最近有活动,购买的商品在最后支付时四舍五入,为了使支付的金钱最少,给买的商品进行分组,要求不准对这些商品排序。解题思路:其实就是给一组数,将这组数插隔板,即隔板dp,dp[i][j]记录的是当有i个数,j个隔板时最少钱。转移方程为dp[i][j] = min(dp[i-1][j-1]+a[i], dp[i-1][j] + a[i]),意思是当有...
2017-02-22 19:26:46 228
原创 B. Code For 1
B. Code For 1time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputJon fought bravely to rescue the wildlings who were attacked by the...
2017-02-21 21:46:23 528
原创 UVA Magical GCD
Magical GCD题意:给定一个数列,求一个子列,该子列的最大公约数乘上子列长度的值最大,输出最大值。数列的大小是100000,这些数的大小是1-10^12。解题思路:一开始想的是用暴力,但数据太大,优化也不行,然后想到是不是dp啊,需要的状态有点多,而且还需要更新前边的,所以也打消了,枚举吧,枚举谁呢,最大公约数的个数也不算多,就枚举公约数吧,之后看了大神的代码,知道想法是对
2017-02-20 21:39:53 344
原创 UVA6588 - Crane
Regionals 2013 >>Europe - Central6588 - Crane题意:给定一组无序数,从1-n,要求排序,排序的要求是选定一个区间[a,b],则这个区间的前一半和后一半互换位置,a到b有偶数个数,问交换几次。解题思路:由于数字个数不多,可以枚举1-n个位置,枚举第i个位置,就找到第i个点所在点的位置,如果可以直接交换就交换,如果不能就一半一半交换。
2017-02-20 16:44:38 211
原创 POJ 1201Intervals(差分约束系统)
IntervalsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 26260 Accepted: 10048DescriptionYou are given n closed, integer intervals [ai, bi] and n intege
2017-02-20 08:31:15 240
原创 D. Mahmoud and a Dictionary(种类并查集)
D. Mahmoud and a Dictionarytime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMahmoud wants to write a new dictionary that contains...
2017-02-16 21:23:23 507
原创 hduCoconuts(离散化)
CoconutsTime Limit: 9000/4500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 747 Accepted Submission(s): 219Problem DescriptionTanBig, a friend of Mr.
2017-02-16 19:35:59 395
原创 ZOJAuxiliary Set
Auxiliary SetTime Limit: 9000/4500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1124 Accepted Submission(s): 351Problem DescriptionGiven a rooted tr
2017-02-16 11:36:53 338
原创 Basic Data Structure
Basic Data StructureTime Limit: 7000/3500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1303 Accepted Submission(s): 320Problem DescriptionMr. Frog l
2017-02-15 20:23:01 253
原创 D. Artsem and Saunders
D. Artsem and Saunderstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputArtsem has a friend Saunders from University of Chicago. S...
2017-02-15 08:58:45 490
原创 POJ 1703Find them, Catch them
Find them, Catch themTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 43751 Accepted: 13478DescriptionThe police office in Tadu City decides to say ends
2017-02-14 15:25:17 177
原创 HDU Coins(dp)
Coins Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13459 Accepted Submission(s): 5383 Problem DescriptionWhuacmers use coins...
2017-02-10 19:09:05 255
原创 POJ 1472Instant Complexity(模拟+dfs)
Instant ComplexityTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2123 Accepted: 737DescriptionAnalyzing the run-time complexity of algorithms is an imp
2017-02-10 14:36:51 344
原创 POJ 3393Lucky and Good Months by Gregorian Calendar(模拟)
Lucky and Good Months by Gregorian CalendarTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1818 Accepted: 618DescriptionHave you ever wondered why nor
2017-02-09 20:33:17 302
原创 最大子矩阵和(dp之路)
题目:给你一个m×n的整数矩阵,在上面找一个x×y的子矩阵,使子矩阵中所有元素的和最大。题解:dp表示从(1,1)到(i,j)的这个矩阵的和,转移方程dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1] + a[i][j];求x*y矩阵的和,转移方程maxx = max(maxx, dp[i][j] - dp[i-x][j] - dp[...
2017-02-09 08:58:39 1561 1
原创 Working out - b(dp之路)
B. Working outtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSummer is coming! It's time for Iahub and Iahubina to work out, as...
2017-02-09 08:33:32 344
原创 股票买卖(dp之路)
8464:股票买卖查看 提交 统计 提问总时间限制:1000ms内存限制:65536kB描述最近越来越多的人都投身股市,阿福也有点心动了。谨记着“股市有风险,入市需谨慎”,阿福决定先来研究一下简化版的股票买卖问题。假设阿福已经准确预测出了某只股票在未来 N 天的价格,他希望买卖两次,使得获得的利润最高。为了计算简单起见,利润的计算方式为卖出的价格减去买入的价格。...
2017-02-08 21:00:36 2088 1
原创 回文最小划分次数(dp之路)
题目:对输入的字符串划分为一组回文字符串,最小的分割次数转换方程:dp[j]=min(dp[j],dp[k-1]+1) 代码: #include<iostream>#include<cstdio>#include<cstring>using namespace std;const int inf=0x3f3f3f3f...
2017-02-08 17:26:56 1621
原创 最大子数组和(dp之路)
题目:给出n个数字a[1] - a[n],求从ai连续到aj的和的最大。 转换方程:dp[i] = max(dp[i-1]+a[i], a[i]); 代码: #include <cstdio>#include <cstring>#include <iostream>using namespace std;int ma...
2017-02-08 16:49:09 512
原创 Mahmoud and a Message - c (dp)
C. Mahmoud and a Messagetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMahmoud wrote a message s of length n. He wants to send ...
2017-02-08 15:41:00 799
原创 Flesch Reading Ease(模拟题)
Flesch Reading EaseTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2290 Accepted: 720DescriptionFlesch Reading Ease, a readability test named after it
2017-02-08 10:01:07 1274
原创 POJ 3007Organize Your Train part II(水题)
Organize Your Train part IITime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8394 Accepted: 2402DescriptionRJ Freight, a Japanese railroad company for fre
2017-02-07 16:36:54 1933
原创 POJ 1416Shredding Company(简单搜索技巧和剪枝)
Shredding CompanyTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 5950 Accepted: 3265DescriptionYou have just been put in charge of developing a new shre
2017-02-07 10:22:06 336
原创 POJ 1961Period(KMP算法)
PeriodTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 17207 Accepted: 8293DescriptionFor each prefix of a given string S with N characters (each charact
2017-02-06 20:52:52 337
原创 POJ 3096 Surprising Strings(水题)
Surprising StringsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7000 Accepted: 4531DescriptionThe D-pairs of a string of letters are the ordered pai
2017-02-06 19:38:07 236
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人