摘要: 题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1297题意:有n个位置,男孩女孩排队,要求女孩至少要2个在一起,求符合规则的结果这一题是排序问题,因为结果非常大,且为前几项相加,所用到了大数的加法。题目的分析也很有意思规... 阅读全文
posted @ 2017-12-08 16:55 詹晔晔(๑>؂<๑) 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThe aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in t... 阅读全文
posted @ 2017-11-09 18:59 詹晔晔(๑>؂<๑) 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 问题描述 给定N个物品,每个物品有一个重量W和一个价值V.你有一个能装M重量的背包.问怎么装使得所装价值最大.每个物品只有一个.输入格式 输入的第一行包含两个整数n, m,分别表示物品的个数和背包能装重量。 以后N行每行两个数Wi和Vi,表示物品的重量和价值输出... 阅读全文
posted @ 2017-11-05 23:36 詹晔晔(๑>؂<๑) 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 问题描述 有n个矩阵,大小分别为a0*a1, a1*a2, a2*a3, ..., a[n-1]*a[n],现要将它们依次相乘,只能使用结合率,求最少需要多少次运算。 两个大小分别为p*q和q*r的矩阵相乘时的运算次数计为p*q*r。输入格式 输入的第一行包含一... 阅读全文
posted @ 2017-11-05 17:17 詹晔晔(๑>؂<๑) 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 用到了 线段树 ,好厉害的题这里要用 scanf 而不是 cin ,不然会超时的。参考:http://www.cnblogs.com/TenosDoIt/p/3453089.html#include #include using namespace std;int a... 阅读全文
posted @ 2017-10-30 19:01 詹晔晔(๑>؂<๑) 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 描述 现在,有一行括号序列,请你检查这行括号是否配对。输入第一行输入一个数N(0#include using namespace std;char stack[1000]; //定义一个栈int main(){ char str[1000]; int n... 阅读全文
posted @ 2017-10-28 16:12 詹晔晔(๑>؂<๑) 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 我们都知道如何计算一个数的阶乘,可是,如果这个数很大呢,我们该如何去计算它并输出它?输入输入一个整数m(0using namespace std;int main(){ int a[20000]={0}; int n; while(cin>>n)... 阅读全文
posted @ 2017-10-28 15:02 詹晔晔(๑>؂<๑) 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 在n*n方陈里填入1,2,...,n*n,要求填成蛇形。例如n=4时方阵为:10 11 12 19 16 13 28 15 14 37 6 5 4输入直接输入方阵的维数,即n的值。(n#include using namespace std;int main(){ ... 阅读全文
posted @ 2017-10-27 16:06 詹晔晔(๑>؂<๑) 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 这一题我写了三个半小时。哈哈 哈哈 呸 想死的心都有了。看了 gakkii 的文章 深受启发,才会出了这一道题题目描述: It is said that in 2011, there are about 100 graduate schools ... 阅读全文
posted @ 2017-10-24 20:51 詹晔晔(๑>؂<๑) 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1=... 阅读全文
posted @ 2017-10-23 18:55 詹晔晔(๑>؂<๑) 阅读(101) 评论(0) 推荐(0) 编辑