
ACM_数学
文章平均质量分 77
HQD因为有趣所以做题
这个作者很懒,什么都没留下…
展开
-
POJ 1496 1850
<br /> <br /> <br /> <br />//递推#include<cstdio>#include<iostream>#include<string>using namespace std;int dp[30][30];//长度为iint sum[30];void init(){ for(int i=1;i<=26;i++) dp[1][i]=1; sum[1]=26; for(int i=2;i<=10;i++) fo原创 2011-03-30 10:56:00 · 711 阅读 · 0 评论 -
poj 2244 Eeny Meeny Moo
<br /> Eeny Meeny MooTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2150 Accepted: 1459<br />DescriptionSurely you have made the experience that when too many people use the Internet simultaneously, the net becomes very, very slow. <br />To put原创 2011-03-30 19:25:00 · 2170 阅读 · 1 评论 -
poj 2506
<br />TilingTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5487 Accepted: 2676<br />DescriptionIn how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles? <br />Here is a sample tiling of a 2x17 rectangle. <br /><br />InputInput is a se原创 2011-03-30 10:57:00 · 1363 阅读 · 0 评论 -
1017 Packets
PacketsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 28741Accepted: 9462<br />DescriptionA factory produces products packed in square packets of the same height h and of the sizes 1*1, 2*2, 3*3, 4*4, 5*5, 6*6. These products are al原创 2011-02-24 10:07:00 · 1213 阅读 · 0 评论 -
1013 Counterfeit Dollar
Counterfeit DollarTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 27942Accepted: 8742<br />DescriptionSally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are true silver dollars; one coin is counterfeit e原创 2011-02-24 11:28:00 · 882 阅读 · 0 评论 -
2409 Let it Bead //polya 定理
Let it BeadTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2209 Accepted: 1363<br />Description"Let it Bead" company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the company name, their business is beads. Their P原创 2011-02-12 16:09:00 · 939 阅读 · 0 评论 -
hdu 1005 矩阵乘法
<br /> Number Sequence<br />Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 37082 Accepted Submission(s): 7790<br />Problem DescriptionA number sequence is defined as follows:<br /><br原创 2011-02-04 15:37:00 · 1420 阅读 · 0 评论 -
hdu A + B Problem II
<br />A + B Problem IITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 71329 Accepted Submission(s): 13022<br /><br /><br />Problem DescriptionI have a very simple problem for you. Given原创 2011-02-03 18:50:00 · 1709 阅读 · 0 评论 -
1032 Parliament
ParliamentTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 12309 Accepted: 5124<br />DescriptionNew convocation of The Fool Land's Parliament consists of N delegates. According to the present regulation delegates should be divided into disjoint gr原创 2011-02-25 09:53:00 · 1053 阅读 · 0 评论 -
1019 Number Sequence
Number SequenceTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 22588Accepted: 6019<br />DescriptionA single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2.原创 2011-02-24 15:19:00 · 694 阅读 · 0 评论 -
hdu 3477 Temperature
<br /> Temperature<br />Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 393 Accepted Submission(s): 143<br /><br />Problem DescriptionMany people like summer as summer has a lot of advantages原创 2010-10-06 19:22:00 · 970 阅读 · 0 评论 -
poj 1664 放苹果
<br />放苹果Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 16904 Accepted: 10656<br />Description把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。<br />Input第一行是测试数据的数目t(0 <= t <= 20)。以下每行均包含二个整数M和N,以空格分开。1<=M,N<=10。<br />Output对输原创 2011-03-30 11:23:00 · 862 阅读 · 0 评论 -
poj 2229 Sumsets
<br />SumsetsTime Limit: 2000MS Memory Limit: 200000KTotal Submissions: 8611 Accepted: 3461<br />DescriptionFarmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer原创 2011-03-30 10:58:00 · 1702 阅读 · 0 评论 -
poj 2549 Sumsets
<br /> SumsetsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6261 Accepted: 1745<br />DescriptionGiven S, a set of integers, find the largest d such that a + b + c = d where a, b, c, and d are distinct elements of S. <br />InputSeveral S, ea原创 2011-03-30 10:59:00 · 1544 阅读 · 0 评论 -
hdu 3625 Examining the Rooms //组合数学DP
做的十分顺利,1Y#include #include long long dp[21][21];double ans[21][21];double out[21][21];long long sum = 0;int main(){ memset(原创 2011-08-29 16:19:19 · 1311 阅读 · 0 评论 -
zju 3526 Weekend Party
每次浙大月赛都打酱油,中午这种题,愣是把数字敲错了。。。。。。。#include #include int num[10];char s[20], s2[10];int t[10];int main(){ int n; whil原创 2011-08-28 22:36:13 · 670 阅读 · 0 评论 -
hdu 3921 Clear All of Them II
可能大家都坑在第一题上了,导致这个比较水的题都不做了#include #include #include #include using namespace std;struct Point{ double x, y;} node[201];st原创 2011-08-12 18:51:33 · 856 阅读 · 0 评论 -
hdu 3925 substring
比赛时候脑子堵得慌,注意进位,这两场比赛都发挥的很不好#include #include #include using namespace std;//////////////////////////////////////#define MAX 10000原创 2011-08-12 10:31:39 · 845 阅读 · 0 评论 -
hdu 3714 Error Curves
去年成都赛区的一道题目,画几个图能YY出事凸函数,接着就是三分解#include #include #include using namespace std;const int N = 10002;const double eps = 1e-10;//开成-8就错了原创 2011-08-09 20:10:42 · 866 阅读 · 0 评论 -
hdu 3884 Hinanai Tenshi’s peach garden
比赛的时候卡题了,这题当时没有看。。。。。题意比较简单,不介绍了简单整理整理思想吧,有些细节的东西是看了标程才明朗起来。题目要求答案是最多收集几个桃子。这种比较容易想到是二分10^4的数据,必须是0(nlgn)以下的算法,二分的话就已经是0(lgn)了,所以下面的验证需要0(n)原创 2011-07-29 14:45:11 · 1156 阅读 · 2 评论 -
BUPT 201 Glorious Array
北邮邀请赛的题目,比赛的时候思路很乱,现在整理下吧。网上已经给出了有公式解法,我这里还是说说树状数组的解法吧题目只有两个操作,一个是将一个点的颜色取反,一个是询问有多少个端点颜色不同并且包含小于k的区间。总体思路是这样首先是用树状数组保存每个点的颜色,如果是1,那个点加1,这是初原创 2011-07-22 09:32:49 · 516 阅读 · 0 评论 -
hdu 3862 The Lost Traveler
昨天悲剧的卡在这题上了和秦牛推出很多个版本的解法就是蛋疼的不过其实思路是比较简单的就是昨天想的那个关键点,就是把这些方向可以看成力矩一样的东西,也就是矢量吧。如果中间能回到原点,那么后面不管有任何操作,都能回到原点的用一句比较简洁的话概括,就是如果所有的向量都不位于任何一条直线的原创 2011-07-20 15:19:19 · 979 阅读 · 0 评论 -
hdu 3830 Checkers
这题目的解法果然是很难想到有一个突破点就是任何一个状态,通过题目所给的移动,都能对应且唯一对应一个b*2=a+c(a所以以这个为根如果不是根的状态,可以让左右两个往里跳,依据是让和中间那个坐标距离缩小这样就可以看作为是向根移动具体的操作用的是辗转相除法的思想接着找初始状态和目标状原创 2011-07-14 10:13:41 · 1156 阅读 · 0 评论 -
hdu 3434 Sequence Adjustment
Sequence AdjustmentTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 477原创 2011-07-03 15:30:36 · 1461 阅读 · 0 评论 -
递推题目大整理
我是被逼的,做这种鸟递推//HDU 2524 //行列相乘,先处理行的情况,接着把一行看成一个元素#includeint main(){ int n,m,t; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&m); int sum=(n*(n+1))>>1; int k=(m*(m+1))>>1; printf("%d/n",sum*k原创 2011-03-31 21:41:00 · 1096 阅读 · 0 评论 -
hdu 2446 Shell Pyramid //二分+二分
<br />Shell PyramidTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)<br />Total Submission(s): 1008 Accepted Submission(s): 364<br /><br /><br />Problem DescriptionIn the 17th century, with thunderous noise, dense smoke原创 2010-10-02 19:16:00 · 1062 阅读 · 0 评论 -
POJ 2739 Sum of Consecutive Prime Numbers
Sum of Consecutive Prime NumbersTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9435 Accepted: 5407<br />DescriptionSome positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a原创 2010-09-23 14:11:00 · 584 阅读 · 0 评论 -
poj 2719 Faulty Odometer
<br /><br />Faulty OdometerTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7042 Accepted: 4375<br />DescriptionYou are given a car odometer which displays the miles traveled as an integer. The odometer has a defect, however: it proceeds from th原创 2010-09-23 10:54:00 · 1425 阅读 · 1 评论 -
信封问题加强版
Maybe some problems is difficult .Do your best ! Everything is possible. My blog : http://acm.awaysoft.com/Problem H Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Oth原创 2010-04-02 22:02:00 · 917 阅读 · 0 评论 -
1423 Big Number
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 14440 Accepted: 4530DescriptionIn many applications very large integers numbers are required. Some of these原创 2010-03-31 18:59:00 · 1484 阅读 · 0 评论 -
2643: Recurring Decimals
2643: Recurring Decimals校赛第一轮一道没有做出来的题目,现在看了别人的思路,那个悲剧啊,这道题要我们求所有6位循环小数稍微思考,得出从1/999999开始,接着一步步往上推,这种数学思想还是要细密才行啊 #includeint gcd(int a,int b){ int t; while(a) { t=b%a;原创 2010-04-11 16:15:00 · 605 阅读 · 0 评论 -
1199: Just the Facts
这是标准的数学题。求N!的非零末位。这也是标准的BT题,光是N就可以到100位。完全没有直接做的办法。还是看LeeMars的报告吧!首先考虑某一个N!(N = 5,由于提出了一个5,因此需要一个2与之配成10,即将尾数除以2。注意到除了0 !和1!,阶乘的最后一个非零数字必为偶数(显然,因为在N!的质因数里2的个数要多),所以有一个很特别的除法规律:2 / 2 = 6,4 / 2 = 2,6 /原创 2010-03-28 09:46:00 · 619 阅读 · 0 评论 -
2305: Answer I 欧拉函数
StatusIn/OutTIME LimitMEMORY LimitSubmit TimesSolved UsersJUDGE TYPEstdin/stdout3s8192K734130StandardConsider a scenario where you are asked to calculate a function原创 2010-03-20 19:57:00 · 616 阅读 · 0 评论 -
1874: Relatives欧拉函数
欧拉函数用来计算比n小且和n互质的正整数的个数,记做:φ(n),其中φ(1)被定义为1,但是并没有任何实质的意义。 (1)当n为质数时,显然φ(n)=n-1; (2)当n为质数P^k时,φ(n)=p^k - p^(k-1) 证明:已知少于小于p^k的正整数个数为p^k-1个,其中 和p^k不互质的正整数有{p×1,p×2,...,p×(p^(k-1)-1)}共计p^原创 2010-03-19 22:18:00 · 852 阅读 · 0 评论 -
筛法求欧拉函数值
做project euler时遇到的欧拉函数。Eulers Totient function, φ(n) [sometimes called the phi function], is used to determine the number of positive numbers less than or equal to n which are relatively pr原创 2010-03-19 22:14:00 · 2796 阅读 · 0 评论 -
2513: Distribute the cows
StatusIn/OutTIME LimitMEMORY LimitSubmit TimesSolved UsersJUDGE TYPEstdin/stdout1s16384K41781StandardAt the beginning ,I’ll tell you an old story . It was abou原创 2010-03-19 21:19:00 · 515 阅读 · 0 评论 -
欧拉函数
在数论,对正整数n,欧拉函数是少于或等于n的数中与n互质的数的数目。此函数以其首名研究者欧拉命名,它又称为Eulers totient function、φ函数、欧拉商数等。 例如φ(8)=4,因为1,3,5,7均和8互质。 从欧拉函数引伸出来在环论方面的事实和拉格朗日定理构成了欧拉定理的证明。 φ函数的值 φ(1)=1(唯一和1互质的数就是1本身)。 若n是质数p的k次幂,原创 2010-03-19 21:55:00 · 1384 阅读 · 0 评论 -
JOJ 2257
#include#includeint main(){ //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); int x,y,l1,l2; bool flag1,flag2; while(scanf("%d%d",&x,&y)!=EOF) { flag1=false; flag2=false; if((x%4==1&&y原创 2010-03-13 15:44:00 · 520 阅读 · 0 评论 -
joj 2568: Think I will Buy Me a Football Team
Falling Stocks. Bankrupted companies. Banks with no Cash. Seems like the best time to invest: ``Think Ill buy me a football team!"No seriously, I think I have the solution to at least the p原创 2010-03-12 21:44:00 · 691 阅读 · 0 评论 -
信封问题 递推
将它变得有趣一点,题目就是:有n个信和信封一一对应,现将n个信分别装入n个信封中,一直他们都没有装入应该装入的信封中,问:有多少种装法?遗憾的是我目前还没有解得一个给n,就能立刻算出装法数的答案,但还是取得了一定的进展,在此分享。设n个信和信封有A(n)种装法。形成数列{A(n)}显而易见的是A(1)=0,A(2)=1而n+1个信和信封的每一种装错装法都可以看作两种情况:1.是n个信和信封原创 2010-04-02 21:03:00 · 1727 阅读 · 0 评论