上一页 1 ··· 13 14 15 16 17
中文题,错排,求概率,不解释,核心思路同 HDU 1465 错排简单思路可看:http://www.cnblogs.com/laiba2004/p/3235934.html//错排,但是我之前叫了几次都是错的,所以,我去看了相关的知识,嘿嘿#include__int64 f(__int64 n){ if(n==1)return 0; if(n==2)return 1; if(n==3) return 2; return (n-1)*(f(n-1)+f(n-2));}int main(){ __int64 t,n,sum,nn; scanf("%I64d",&... Read More
posted @ 2013-08-07 16:09 laiba2004 Views(160) Comments(0) Diggs(0) Edit
简而言之,就是把n个信封全部装错的可能数。(中问题,具体看题目)//当n个编号元素放在n个编号位置,元素编号与位置编号各不对应的方法数用M(n)表示,//那么M(n-1)就表示n-1个编号元素放在n-1个编号位置,各不对应的方法数,其它类推.//第一步,把第n个元素放在一个位置,比如位置k,一共有n-1种方法;//第二步,放编号为k的元素,这时有两种情况⑴把它放到位置n,那么,对于剩下的n-1个元素,//由于第k个元素放到了位置n,剩下n-2个元素就有M(n-2)种方法;//⑵第k个元素不把它放到位置n,这时,对于这n-1个元素,有M(n-1)种方法;//综上得到//M(n)=(n-1)[M( Read More
posted @ 2013-08-04 09:02 laiba2004 Views(185) Comments(0) Diggs(0) Edit
题目意思很简单,就是找n=p1+p2的种类数,具体看题目吧。次重点是查找一定范围内的素数;重点是用二分查找,不然会超时!!!#include#includeint main(){ int n,i,f,j,a[10000],num,s,l,r,mid; a[0]=2;s=1; for(i=3;ii) break; if(i%a[j]==0) { f=1; break; } } if(f==0) ... Read More
posted @ 2013-08-03 16:20 laiba2004 Views(149) Comments(0) Diggs(0) Edit
这题简单,只要看懂题目就好,坑爹的是我的英语水平太差了,wa了n次,所以 仅此纪念 一下。//坑爹的英语题目,注意重点:move d times clockwise the current time #include#includeint main(){ int s,d,i,e,f[66]; while(scanf("%d%d",&s,&d)!=EOF) { if(s==0&&d==0)break; e=s; for(i=0;i<60;i++)//标记一下,以免超时 f[i]=0; f[e]=1; ... Read More
posted @ 2013-08-03 14:43 laiba2004 Views(209) Comments(0) Diggs(0) Edit
HDU 1163题意简单,求n^n的(1)各数位的和,一旦和大于9,和再重复步骤(1),直到和小于10.//方法一:就是求模9的余数嘛! (228) leizh007 2012-03-26 21:03:19 (确实可行)#include#includeint main(){ int n,i,ans; while(scanf("%d",&n),n) { ans=1; for(i=0;i#includeint f(int num){ int ans=0; while(num) { ans=num%10+ans; ... Read More
posted @ 2013-08-01 22:14 laiba2004 Views(130) Comments(0) Diggs(0) Edit
以下引用自http://acm.hdu.edu.cn/discuss/problem/post/reply.php?postid=8466&messageid=2&deep=1题意以及简单证明Posted by hncu1106101-王志盼 at 2012-10-19 16:35:42 on Problem 1098 有一个函数: f(x)=5*x^13+13*x^5+k*a*x给定一个非负的 k 值 求最小的非负的 a 值 使得对任意的整数x都能使 f(x) 被 65 整除。每输入一个k 值 , 对应输出一个 a值 , 若不存在a值 则输出 no 数学归纳法证明:... Read More
posted @ 2013-08-01 21:00 laiba2004 Views(171) Comments(0) Diggs(0) Edit
以下引用部分全都来自:http://blog.csdn.net/ice_crazy/article/details/7478802 Ice—Crazy的专栏分析:HDU 1028 摘: 本题的意思是:整数划分问题是将一个正整数n拆成一组数连加并等于n的形式,且这组数中的最大加数不大于n。 如6的整数划分为 6 5 + 1 4 + 2, 4 + 1 + 1 3 + 3, 3 + 2 + 1, 3 + 1 + 1 + 1 2 + 2 + 2, 2 + 2 + 1 + 1, 2 + 1 + 1 + 1 + 1 1 + 1 + 1 + 1 + ... Read More
posted @ 2013-07-31 14:49 laiba2004 Views(162) Comments(0) Diggs(0) Edit
上一页 1 ··· 13 14 15 16 17