题解

245 条题解

  • 0
    @ 2009-02-25 16:12:41

    第3388个过的

    有纪念意义啊

    还有深意的!

  • 0
    @ 2009-02-12 21:04:56

    数据真是弱,暴搜也能过....- -|||

    类型要用longint

  • 0
    @ 2009-02-05 20:28:25

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 41ms

    ├ 测试数据 05:答案正确... 697ms

    新手,不懂搜索...

    不懂动态规划...

    不懂排列组合...

    用最简单的方法解决问题...

    只懂基本语言...

    但一样AC

    一种学两个月就会的方法....

    program zhhy;

    var n,k:integer;

    sum:longint;

    procedure dd(x:integer);

    var i1,i2,i3,i4,i5,i6:integer;

    begin

    case x of

    2:begin

    for i1:=1 to n-1 do

    for i2:=i1 to n-i1 do

    if i1+i2=n then inc(sum);

    end;

    3:begin

    for i1:=1 to n-1 do

    for i2:=i1 to n-i1 do

    for i3:=i2 to n-i1-i2 do

    if i1+i2+i3=n then inc(sum);

    end;

    4:begin

    for i1:=1 to n-1 do

    for i2:=i1 to n-i1 do

    for i3:=i2 to n-i1-i2 do

    for i4:=i3 to n-i1-i2-i3 do

    if i1+i2+i3+i4=n then inc(sum);

    end;

    5:begin

    for i1:=1 to n-1 do

    for i2:=i1 to n-i1 do

    for i3:=i2 to n-i1-i2 do

    for i4:=i3 to n-i1-i2-i3 do

    for i5:=i4 to n-i1-i2-i3-i4 do

    if i1+i2+i3+i4+i5=n then inc(sum);

    end;

    6:begin

    for i1:=1 to n-1 do

    for i2:=i1 to n-i1 do

    for i3:=i2 to n-i1-i2 do

    for i4:=i3 to n-i1-i2-i3 do

    for i5:=i4 to n-i1-i2-i3-i4 do

    for i6:=i5 to n-i1-i2-i3-i4-i5 do

    if i1+i2+i3+i4+i5+i6=n then inc(sum);

    end;

    end;

    end;

    begin

    sum:=0;

    read(n,k);

    dd(k);

    writeln(sum);

    readln;

    end.

  • 0
    @ 2009-01-23 15:10:25

    program p117;

    const maxn=200;

    maxk=6;

    var n,k,i,j:integer;

    f:array[-5..maxn,0..maxk] of longint;

    begin

    readln(n,k);

    f[1,1]:=1;

    for i:=1 to n do

    for j:=1 to k do

    if not((i=1) and (j=1)) then

    f:=f+f;

    writeln(f[n,k]);

    end.

    20留念

  • 0
    @ 2008-12-17 18:29:49

    pROGRAM P1117;

    var a:array[0..200,0..6]of longint;

    var i,j,n,k:longint;

    begin

    readln(n,k);

    a[0,0]:=1;

    for i:=1 to n do a:=1;

    for i:=2 to n do

    for j:=2 to k do

    a:=a+a;

    writeln(a[n,k]);

    end.

  • 0
    @ 2008-12-11 13:15:18

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    program p1117;

    const

    maxn=200;

    maxk=6;

    var

    n,k,i,j:integer;

    f:array[0..maxn,0..maxk] of longint;

    begin

    readln(n,k);

    f[0,0]:=1;

    for i:=1 to n do

    f:=1;

    for i:=1 to n do

    for j:=1 to k do

    if i>=j

    then f:=f+f;

    writeln(f[n,k]);

    end.

  • 0
    @ 2008-11-30 20:51:59

    同楼下某牛。。

    打表不是这样用滴~

    10题AC 纪念~

  • 0
    @ 2008-11-25 20:30:53

    同楼下某牛

    maddog

    70AC 纪念。。。

    ( 2008-9-27 13:21:35 )

  • 0
    @ 2008-11-13 22:43:23

    敢问GDcaca。。。。

    算出所有数据用了多少时间。。。。

  • 0
    @ 2008-11-11 18:36:59

    var

    n,k:longint;

    total:longint;

    procedure dfs(st,m:longint);

    var i:longint;

    fn:longint;

    begin

    if m=k then

    begin

    inc(total);

    exit;

    end;

    fn:=n div (k-m+1);

    for i:=st to fn do

    begin

    n:=n-i;

    dfs(i,m+1);

    n:=n+i;

    end;

    end;

    begin

    readln(n,k);

    total:=0;

    dfs(1,1);

    writeln(total);

    end.

    算一下每层扩展的范围就行了,DFS全0

  • 0
    @ 2008-11-10 16:13:13

    半年以后看这道题,发现不用知道公式也能AC,不过貌似时间慢了点写个dfs先,再加个记忆化,很好很强大

  • 0
    @ 2008-11-08 11:51:40

    交表王道!!

  • 0
    @ 2008-11-08 10:50:05

    确实。。。。。。。。。。。。

  • 0
    @ 2008-11-07 19:12:08

    楼下的就是一个傻叉!!!!!

  • 0
    @ 2008-11-07 13:59:49

    给一个O(1)的:

    const data:array[1..200,1..6]of longint=

    ((1,0,0,0,0,0),

    (1,1,0,0,0,0),

    (1,1,1,0,0,0),

    (1,2,1,1,0,0),

    (1,2,2,1,1,0),

    (1,3,3,2,1,1),

    (1,3,4,3,2,1),

    (1,4,5,5,3,2),

    (1,4,7,6,5,3),

    (1,5,8,9,7,5),

    (1,5,10,11,10,7),

    (1,6,12,15,13,11),

    (1,6,14,18,18,14),

    (1,7,16,23,23,20),

    (1,7,19,27,30,26),

    (1,8,21,34,37,35),

    (1,8,24,39,47,44),

    (1,9,27,47,57,58),

    (1,9,30,54,70,71),

    (1,10,33,64,84,90),

    (1,10,37,72,101,110),

    (1,11,40,84,119,136),

    (1,11,44,94,141,163),

    (1,12,48,108,164,199),

    (1,12,52,120,192,235),

    (1,13,56,136,221,282),

    (1,13,61,150,255,331),

    (1,14,65,169,291,391),

    (1,14,70,185,333,454),

    (1,15,75,206,377,532),

    (1,15,80,225,427,612),

    (1,16,85,249,480,709),

    (1,16,91,270,540,811),

    (1,17,96,297,603,931),

    (1,17,102,321,674,1057),

    (1,18,108,351,748,1206),

    (1,18,114,378,831,1360),

    (1,19,120,411,918,1540),

    (1,19,127,441,1014,1729),

    (1,20,133,478,1115,1945),

    (1,20,140,511,1226,2172),

    (1,21,147,551,1342,2432),

    (1,21,154,588,1469,2702),

    (1,22,161,632,1602,3009),

    (1,22,169,672,1747,3331),

    (1,23,176,720,1898,3692),

    (1,23,184,764,2062,4070),

    (1,24,192,816,2233,4494),

    (1,24,200,864,2418,4935),

    (1,25,208,920,2611,5427),

    (1,25,217,972,2818,5942),

    (1,26,225,1033,3034,6510),

    (1,26,234,1089,3266,7104),

    (1,27,243,1154,3507,7760),

    (1,27,252,1215,3765,8442),

    (1,28,261,1285,4033,9192),

    (1,28,271,1350,4319,9975),

    (1,29,280,1425,4616,10829),

    (1,29,290,1495,4932,11720),

    (1,30,300,1575,5260,12692),

    (1,30,310,1650,5608,13702),

    (1,31,320,1735,5969,14800),

    (1,31,331,1815,6351,15944),

    (1,32,341,1906,6747,17180),

    (1,32,352,1991,7166,18467),

    (1,33,363,2087,7599,19858),

    (1,33,374,2178,8056,21301),

    (1,34,385,2280,8529,22856),

    (1,34,397,2376,9027,24473),

    (1,35,408,2484,9542,26207),

    (1,35,420,2586,10083,28009),

    (1,36,432,2700,10642,29941),

    (1,36,444,2808,11229,31943),

    (1,37,456,2928,11835,34085),

    (1,37,469,3042,12470,36308),

    (1,38,481,3169,13125,38677),

    (1,38,494,3289,13811,41134),

    (1,39,507,3422,14518,43752),

    (1,39,520,3549,15257,46461),

    (1,40,533,3689,16019,49342),

    (1,40,547,3822,16814,52327),

    (1,41,560,3969,17633,55491),

    (1,41,574,4109,18487,58767),

    (1,42,588,4263,19366,62239),

    (1,42,602,4410,20282,65827),

    (1,43,616,4571,21224,69624),

    (1,43,631,4725,22204,73551),

    (1,44,645,4894,23212,77695),

    (1,44,660,5055,24260,81979),

    (1,45,675,5231,25337,86499),

    (1,45,690,5400,26455,91164),

    (1,46,705,5584,27604,96079),

    (1,46,721,5760,28796,101155),

    (1,47,736,5952,30020,106491),

    (1,47,752,6136,31289,111999),

    (1,48,768,6336,32591,117788),

    (1,48,784,6528,33940,123755),

    (1,49,800,6736,35324,130019),

    (1,49,817,6936,36756,136479),

    (1,50,833,7153,38225,143247),

    (1,50,850,7361,39744,150224),

    (1,51,867,7586,41301,157532),

    (1,51,884,7803,42910,165056),

    (1,52,901,8037,44559,172929),

    (1,52,919,8262,46262,181038),

    (1,53,936,8505,48006,189509),

    (1,53,954,8739,49806,198230),

    (1,54,972,8991,51649,207338),

    (1,54,990,9234,53550,216705),

    (1,55,1008,9495,55496,226479),

    (1,55,1027,9747,57501,236534),

    (1,56,1045,10018,59553,247010),

    (1,56,1064,10279,61667,257783),

    (1,57,1083,10559,63829,269005),

    (1,57,1102,10830,66055,280534),

    (1,58,1121,11120,68331,292534),

    (1,58,1141,11400,70673,304865),

    (1,59,1160,11700,73067,317683),

    (1,59,1180,11990,75529,330850),

    (1,60,1200,12300,78045,344534),

    (1,60,1220,12600,80631,358579),

    (1,61,1240,12920,83273,373165),

    (1,61,1261,13230,85987,388138),

    (1,62,1281,13561,88759,403670),

    (1,62,1302,13881,91606,419609),

    (1,63,1323,14222,94512,436140),

    (1,63,1344,14553,97495,453091),

    (1,64,1365,14905,100540,470660),

    (1,64,1387,15246,103664,488678),

    (1,65,1408,15609,106852,507334),

    (1,65,1430,15961,110121,526461),

    (1,66,1452,16335,113456,546261),

    (1,66,1474,16698,116875,566547),

    (1,67,1496,17083,120362,587535),

    (1,67,1519,17457,123935,609040),

    (1,68,1541,17854,127578,631269),

    (1,68,1564,18239,131310,654039),

    (1,69,1587,18647,135114,677571),

    (1,69,1610,19044,139009,701661),

    (1,70,1633,19464,142979,726544),

    (1,70,1657,19872,147042,752019),

    (1,71,1680,20304,151182,778311),

    (1,71,1704,20724,155418,805221),

    (1,72,1728,21168,159733,832989),

    (1,72,1752,21600,164147,861394),

    (1,73,1776,22056,168642,890691),

    (1,73,1801,22500,173238,920661),

    (1,74,1825,22969,177918,951549),

    (1,74,1850,23425,182702,983139),

    (1,75,1875,23906,187572,1015691),

    (1,75,1900,24375,192548,1048966),

    (1,76,1925,24869,197613,1083239),

    (1,76,1951,25350,202787,1118274),

    (1,77,1976,25857,208052,1154336),

    (1,77,2002,26351,213429,1191191),

    (1,78,2028,26871,218899,1229120),

    (1,78,2054,27378,224484,1267865),

    (1,79,2080,27911,230165,1307723),

    (1,79,2107,28431,235963,1348439),

    (1,80,2133,28978,241860,1390299),

    (1,80,2160,29511,247877,1433051),

    (1,81,2187,30071,253995,1476997),

    (1,81,2214,30618,260236,1521860),

    (1,82,2241,31192,266581,1567959),

    (1,82,2269,31752,273052,1615020),

    (1,83,2296,32340,279629,1663351),

    (1,83,2324,32914,286335,1712680),

    (1,84,2352,33516,293150,1763332),

    (1,84,2380,34104,300097,1815010),

    (1,85,2408,34720,307156,1868056),

    (1,85,2437,35322,314349,1922176),

    (1,86,2465,35953,321657,1977700),

    (1,86,2494,36569,329103,2034337),

    (1,87,2523,37214,336666,2092435),

    (1,87,2552,37845,344370,2151676),

    (1,88,2581,38505,352194,2212426),

    (1,88,2611,39150,360162,2274370),

    (1,89,2640,39825,368253,2337862),

    (1,89,2670,40485,376491,2402590),

    (1,90,2700,41175,384855,2468926),

    (1,90,2730,41850,393369,2536531),

    (1,91,2760,42555,402012,2605795),

    (1,91,2791,43245,410808,2676382),

    (1,92,2821,43966,419736,2748670),

    (1,92,2852,44671,428821,2822326),

    (1,93,2883,45407,438040,2897747),

    (1,93,2914,46128,447419,2974571),

    (1,94,2945,46880,456936,3053214),

    (1,94,2977,47616,466616,3133318),

    (1,95,3008,48384,476437,3215286),

    (1,95,3040,49136,486424,3298763),

    (1,96,3072,49920,496555,3384171),

    (1,96,3104,50688,506856,3471126),

    (1,97,3136,51488,517304,3560070),

    (1,97,3169,52272,527925,3650622),

    (1,98,3201,53089,538696,3743211),

    (1,98,3234,53889,549644,3837459),

    (1,99,3267,54722,560745,3933815),

    (1,99,3300,55539,572026,4031871),

    (1,100,3333,56389,583464,4132096));

    var n,k:integer;

    begin

    readln(n,k);

    writeln(data[n,k])

    end.

  • 0
    @ 2008-11-06 18:57:04

    看着 题解 过了 这题

    感觉 这个 递推 公式 很神奇

    坦白说 要 自己想 我是 想不出来的

    所以

    膜拜 一下 那些 自己 想出 递推公式 的 牛们。。。

  • 0
    @ 2008-11-05 17:39:58

    设F为数I分为j部分的个数,则有F:=F+F;(I>=J)

    初始F[0,0]:=1;目标F[N,M];

  • 0
    @ 2008-11-04 20:23:44

    竟然把数组开小了~~气死~~~RP…………so low!!!!

  • 0
    @ 2008-11-03 19:52:22

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

  • 0
    @ 2008-11-02 16:05:11

    爆短的搜索过了……太无语了

信息

ID
1117
难度
3
分类
动态规划 点击显示
标签
递交数
6168
已通过
3140
通过率
51%
被复制
14
上传者