I and OI
Past...
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 35 下一页
摘要: 题意:求将N分成K个不同质数的和的方案数.分析:筛法,然后直接背包之~~.code:const MAX=1200; maxn=1200; maxk=15;var Prime:array[0..MAX] of longint; P:array[0..MAX] of boolean; f:array[0..maxn,0..maxk] of longint; size,n,k,i,j,o,tmp:longint; procedure GetPrime; begin size:=0; fillchar(P,sizeof(P),0); for i:=2 to MAX do begin if not P[ 阅读全文
posted @ 2011-08-13 14:07 exponent 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 基本同RQNOJ的POWER.见我写的解题报告:http://www.cnblogs.com/exponent/archive/2011/08/08/2130723.htmlcode:const oo=1000000000000000;var f:array[0..1010,0..1010,0..1] of int64; g:array[0..1010,0..1010] of longint; d:array[0..1010] of longint; n,i,j,l,p:longint; flag:boolean; procedure sort(l,r:longint); var i,j,mi 阅读全文
posted @ 2011-08-13 14:01 exponent 阅读(307) 评论(0) 推荐(0) 编辑
摘要: 题意:给出M,S,和M对ai,bi.选出最少对的ai,bi,使得(∑ai)^2+(∑bi)^2=s^2.分析:背包.f[i,j]表示构成∑ai=i,∑bi=j的最少对数.(很少人做的水题)code:const oo=16843009;var f:array[0..310,0..310] of longint; a,b:array[0..50] of longint; n,m,s,d,o,i,j,k,ans:longint; function min(a,b:longint):longint; begin if a>b then exit(b); exit(a); end;begin re 阅读全文
posted @ 2011-08-13 13:59 exponent 阅读(217) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 35 下一页