暴力
Kefault
这个作者很懒,什么都没留下…
展开
-
UVA 10112 - Myacm Triangles
10112 - Myacm Triangles 解题报告" alt="UVA 10112 - Myacm Triangles 解题报告" src="http://uva.onlinejudge.org/external/101/p10112.gif" style="list-style-type:none; border-top:0px; border-right:0px; border-bott原创 2013-08-04 20:37:12 · 736 阅读 · 0 评论 -
hdu 4925 Apple Tree
Apple TreeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 251 Accepted Submission(s): 176Problem DescriptionI’ve bought an原创 2014-08-08 09:31:15 · 1032 阅读 · 0 评论 -
UVALive 5029 Encoded Barcodes
Encoded BarcodesTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluSubmit Status Practice UVALive 5029DescriptionAll the big malls need a powerful system f原创 2014-08-08 20:17:16 · 885 阅读 · 0 评论 -
UVALive 5025 Arranging Your Team
Arranging Your TeamTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluSubmit Status Practice UVALive 5025DescriptionYour country has qualified for the FIFA 2原创 2014-08-08 20:42:31 · 848 阅读 · 0 评论 -
bnu 34982 Beautiful Garden
Beautiful GardenThere are n trees planted in lxhgww's garden. You can assume that these trees are planted along the X-axis, and the coordinate of ith tree is xi.But in rece原创 2014-08-16 20:18:28 · 968 阅读 · 0 评论 -
hdu 4952 Number Transformation
Number TransformationTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 617 Accepted Submission(s): 313Problem DescriptionTeache原创 2014-08-15 18:37:36 · 905 阅读 · 0 评论 -
hdu 5007 Post Robot
Post RobotTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 253 Accepted Submission(s): 207Problem DescriptionDT is a big fan o原创 2014-09-15 19:04:17 · 1261 阅读 · 0 评论 -
hdu 5073 Galaxy
GalaxyTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 323 Accepted Submission(s): 71Special JudgeProblem DescriptionGood ne原创 2014-10-22 20:13:41 · 2031 阅读 · 0 评论 -
acdream 1431 Sum vs Product
Sum vs ProductTime Limit: 4000/2000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others)SubmitStatisticNext ProblemProblem Description Peter has just learned mathematics. H原创 2014-10-06 18:26:27 · 1145 阅读 · 0 评论 -
hdu 5175-Misaki's Kiss again
题目及代码:题目大意就是 给定一个数n,找出所有的m(m>=1&&m 本来觉得这个n一定是要进行素因子分解的,之后利用因子枚举n所有的约数,然后思路就断了。索性看了看官方的题解,的确是要枚举n所有的因子,不过不需要素因子分解,直接暴力就可以了。然后我们假设gcd(n,m)=k,这里k是n的一个因子,那么我们就可以得出n^m=k,这里两边同时亦或n,原创 2015-03-11 14:57:39 · 675 阅读 · 0 评论 -
poj 1564 Sum It Up
DescriptionGiven a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up to t. For example, if t = 4, n = 6, and the list is [4, 3, 2, 2, 1, 1],原创 2013-08-17 18:34:57 · 1250 阅读 · 0 评论 -
hdu 4770 Lights Against Dudely
Problem DescriptionHarry: "But Hagrid. How am I going to pay for all of this? I haven't any money." Hagrid: "Well there's your money, Harry! Gringotts, the wizard bank! Ain't no safer place. Not原创 2014-06-04 16:07:37 · 1008 阅读 · 0 评论 -
UVA 539 The Settlers of Catan
Within Settlers of Catan, the 1995 German game of the year, players attempt to dominate an island by building roads, settlements and cities across its uncharted wilderness.You are employed by a soft原创 2013-08-07 14:45:11 · 746 阅读 · 0 评论 -
按字典序输出数组内元素的全排列
#include #include #include #include #include using namespace std;bool cmp(char a,char b){ return a<b;}void print_permutation(int n,char *A,char *P,int cur){ int i,j;原创 2013-08-09 17:10:33 · 1097 阅读 · 0 评论 -
子集生成(三种方法)
#include #include #include #include using namespace std;void print_subset1(int n,int *A,int cur) //增量构造法{ for(int i=0;i<cur;i++) printf("%d",A[i]); if(cur!=0) printf("\n");原创 2013-08-11 16:43:17 · 958 阅读 · 0 评论 -
nefu 640 Number Guessing
题目:大意就是猜数,给定个四位数,然后给出这个数与正确的数之间的比较(#A*B,#代表有#个数字他的值和位置都对了,*代表有*个数的值对了),给出n个上述的4位数,让你确定这个正确的数是多少。思路:直接暴力。注意:程序结束是n为负数,而不是-1,为此超时了两次 T T。代码:#include #include #include using namespace std;str原创 2014-05-01 19:56:17 · 875 阅读 · 0 评论 -
nefu 650 max num
题目:经典dp题目,求出最大相邻子序列的和。方法:给出两种方法,一种dp,一种直接暴力(数据量小的时候可以考虑)。代码1:#include #include using namespace std;int main(){ int n; int t=1; cin>>n; int s[100010]; while(t<=n) {原创 2014-05-02 14:24:08 · 904 阅读 · 0 评论 -
nefu 627 剪纸游戏
题目:给定一个n*m大的纸张,上面表明了每块上的字母,在其背后给定了对应位置的字母的value,在最后给出需要剪出来的剪纸的字母序列。方法:暴力搜索。代码:#include #include #include #include using namespace std;char map[502][502];int Map[502][502];int vis[502][502原创 2014-05-02 14:36:14 · 1138 阅读 · 0 评论 -
codeforces 221D Little Elephant and Array
题目的意思是说,给定一个区间,其长度为m,然后进行n次查询,每次查询给定区间[l,r],查出区间中出现次数等于其值大小的数的个数。开始做的时候,不是超空间就是超时间,然后借鉴了一下别人的思路。 首先使用一个a数组记录m个元素,期间用b数组记录每个元素出现的次数,然后在用l数组和r数组记录给定的查询区间,因为已经记录每个元素的出现次数,所以那些出现次数小于其值的数根本就不用考虑了,然后就是从原创 2014-03-20 20:02:19 · 1460 阅读 · 0 评论 -
codeforces 202B Brand New Easy Problem
题目的意思就是说给定不超过四个词的句子,将这几个次进行全排列,然后在去下面给出的例子中进行匹配,如果某个全排列匹配成功的话,就求出其逆序数,找到符合情况的逆序数最小的情况,如果有多的选择,则选择编号最小的情况,并按照给定的格式进行输出。 题目中说到就是子串中的单词不会重复,但是匹配串会有单词重复,如果说去每个匹配串中找到相应的单词,并求出所有可能的逆序的话,这样的任务量会很大。不如就是原创 2014-03-21 21:06:52 · 1277 阅读 · 0 评论 -
hdu 2521 反素数
#include #include #include using namespace std;typedef long long LL;LL p[]= {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79};LL s[5050];void solve(){ memset(s,0,siz原创 2014-04-04 20:00:29 · 801 阅读 · 0 评论 -
hdu 5191-Building Blocks
题目及代码:题目的意思是有n堆积木,每堆积木上有一定数目的积木,现在我想移动一些积木(每次移动一个),可以用一些积木重新添加一堆积木,但不能在两堆之间添加,使得出现连续的W堆积木,每堆的数目为H。由于的连续的W堆,那么这样思路就好想了。我们首先求出第一组1-W堆中需要的最小数目(求法是求出这W堆中多于H的堆减去H的总和l和少于H的堆减去H的总和的绝对值r,取l和r中的最大值,想一想为什么?原创 2015-03-22 18:35:33 · 902 阅读 · 0 评论