• BZOJ 1801: [Ahoi2009]chess 中国象棋


    Time Limit: 10 Sec  Memory Limit: 64 MB
    Submit: 1937  Solved: 1121
    [Submit][Status][Discuss]

    Description

    在N行M列的棋盘上,放若干个炮可以是0个,使得没有任何一个炮可以攻击另一个炮。 请问有多少种放置方法,中国像棋中炮的行走方式大家应该很清楚吧.

    Input

    一行包含两个整数N,M,中间用空格分开.

    Output

    输出所有的方案数,由于值比较大,输出其mod 9999973

    Sample Input

    1 3

    Sample Output

    7

    HINT

    除了在3个格子中都放满炮的的情况外,其它的都可以.

    100%的数据中N,M不超过100
    50%的数据中,N,M至少有一个数不超过8
    30%的数据中,N,M均不超过6

    Source

     
    f[i][j][k]表示截止到第i行为止,在所有的列中有一个炮的有j列,有2个炮的有k列。

    推想出以下6种状态:

    1:在下一行什么也不放: f[i+1][j][k]=f[i+1][j][k]+f[i][j][k];

    2:在下一行中找一个0个炮的列去放一个炮:  f[i+1][j+1][k]=f[i+1][j+1][k]+f[i][j][k]*(m-j-k);

    3:在下一行中找一个1个炮的列去放一个炮:  f[i+1][j-1][k+1]=f[i+1][j-1][k+1]+f[i][j][k]*j;

    4:在下一行中找两个0个炮的列去分别放一个炮:  f[i+1][j+2][k]=f[i+1][j+2][k]+f[i][j][k]*(m-j-k)*(m-j-k-1)/2;

    (这里运用了组合数公式,因为有m-j-k个0个炮的列,任选两个进行组合,一共有C2m-j-k种放法,化简开来就是有(m-j-k)*(m-j-k-1)/2种)

    5:在下一行中找一个0个炮的列和一个1个炮的列分别去放一个炮:  f[i+1][j][k+1]=f[i+1][j][k+1]+f[i][j][k]*(m-j-k)*j;

    6:在下一行中找两个1个炮的列去分别放一个炮:  f[i+1][j-2][k+2]=f[i+1][j-2][k+2]+f[i][j][k]*j*(j-1)/2;

    最后的ans是所有的f[n]加起来:  ans=ans+f[n][j][k];

    (copy(原地址))

    屠龙宝刀点击就送

    存一下考场的无敌做法

    O(1)的 (只可惜只有10分。。没弄全);

    #include <cstdio>
    #define N 105
    int n,m;
    long long ans[N][N]={{2,4,7,11,16,22,29,37,46,56,67,79,92,106,121,137,154,172,191,211,232,254,277,301,326,352,379,407,436,466,497,529,562,596,631,667,704,742,781,821,862,904,947,991,1036,1082,1129,1177,1226,1276,1327,1379,1432,1486,1541,1597,1654,1712,1771,1831,1892,1954,2017,2081,2146,2212,2279,2347,2416,2486,2557,2629,2702,2776,2851,2927,3004,3082,3161,3241,3322,3404,3487,3571,3656,3742,3829,3917,4006,4096,4187,4279,4372,4466,4561,4657,4754,4852,4951,5051},
                         {4,16,49,121,256,484,841,1369,2116,3136,4489,6241,8464,11236,14641,18769,23716,29584,36481,44521,53824,64516,76729,90601,106276,123904,143641,165649,190096,217156,247009,279841,315844,355216,398161,444889,495616,550564,609961,674041,743044,817216,896809,982081,73313,170741,274658,385346,503093,628193,760946,901658,50658,208230,374715,550443,735750,930978,136492,352612,579715,818167,68357,330629,605384,893012,193926,508494,837141,180298,538351,911743,300923,706295,128337,567465,24169,498877,992074,504251,35871,587403,159373,752245,366557,2802,661479,343144,48308,777488,531258,310147,114707,945479,803061,688006,600890,542295,512809,513026},
                         {7,49,265,1081,3481,9367,22009,46585,90811,165661,286177,472369,750205,152708,721058,505971,568930,983693,837823,234274,293101,153311,974685,939843,256229,158288,909750,805987,176375,386831,842474,990291,321927,376531,743794,66992,46068,440957,74899,837791,689816,664924,874590,511594,853840,268401,215467,252570,38780,339008,28467,97104,654241,933255,296331,239288,396597,546387,615575,685086,995163,950784,127135,275156,327296,403205,815601,76244,901864,220451,177278,141337,711661,723855,256615,638388,454190,552361,51563,347732,121273,344175,287369,528057,957216,787158,559146,151168,785733,37876,843015,505238,705323,509137,375938,166869,153491,26440,904123,341623},
                         {11,121,1081,7343,37441,149311,490631,386798,481594,948300,791333,261052,407035,797530,435235,902184,769206,307434,542456,693880,45571,294508,428797,187488,157840,567960,835262,933729,645566,765216,326401,925081,214237,648156,557419,637191,934918,425427,264132,811756,526193,819722,982645,276380,301968,752473,659951,250473,523173,671761,469342,740140,44161,703094,298898,778091,298416,955923,534131,418366,821928,472478,909845,549228,665659,458878,359577,741034,202389,592283,944526,499334,986705,350990,97725,447126,480438,468189,571971,113720,609004,763603,634692,161002,268463,760591,205214,31703,55649,649971,784402,157497,648048,315345,179783,18583,413218,288131,182495,499642},
                         {16,256,3481,37441,304186,859943,871377,590219,851614,245091,244338,627109,581314,93002,658598,171376,113529,55332,32550,758625,940712,322404,584832,14366,2811,99582,595755,603196,409442,655560,712171,632174,350925,498540,398696,666520,399133,388398,191236,380358,982361,102943,154637,54738,361530,681870,923061,192356,480403,814989,450456,981516,149704,659846,658038,751528,692301,209526,77505,457424,966666,922446,890094,154150,135418,213691,995859,907817,197445,130241,450719,185772,694160,632430,324629,6198,672829,917877,299321,553835,483642,695017,680169,118178,840927,779016,483467,626828,332995,383981,416894,268177,759336,561453,438201,263165,848846,926901,693804,298080},
                         {22,484,9367,149311,859943,526101,922457,947915,678888,646926,193281,916181,626250,241339,912723,933581,10257,945986,147659,339019,924184,298871,489382,446044,456409,979197,893106,13466,689572,404781,205998,219705,760404,953892,262717,718352,441411,564069,830759,770851,685432,967924,97606,514554,394540,846226,359234,376737,912903,243839,224063,842311,611060,408456,807853,799097,383714,748745,691095,425303,746124,232840,378984,400176,274497,124843,218089,17054,271602,963467,891903,135112,823540,326058,705818,180158,229592,234400,209954,846868,941284,37491,105678,24732,979003,302667,236612,143262,290187,891864,881397,219434,421700,508064,461223,341126,815654,485878,995956,546151},
                         {29,841,22009,490631,871377,922457,243963,250961,17941,487804,127548,597181,548897,271723,176185,98747,284236,885731,201236,375688,830703,499876,433898,430691,692079,484018,414614,900580,24207,631740,102471,180521,74134,187068,600541,215301,255117,358907,544939,197494,301386,901619,82209,798298,520662,537979,294406,144716,374741,146770,869879,957912,972028,917052,713264,887520,805322,421830,637644,205054,610758,387437,590215,285711,755016,987647,199907,120406,645883,617621,760663,598697,437452,499867,184939,645657,911391,533943,705968,978988,425041,825682,776324,139806,229168,781851,878133,154647,24176,602661,414181,513767,107734,464794,102254,241259,554410,505187,93837,703782},
                         {37,1369,46585,386798,590219,947915,250961,341999,620104,456808,49812,44529,926241,66306,159867,279092,559843,459933,411631,330272,313146,57216,775367,827872,141052,746587,483124,616836,887635,389506,350674,548345,645088,401772,683773,132971,363536,414852,414250,940880,120252,313222,703966,528956,929468,307097,26346,756827,148180,329418,37277,865657,570603,989565,613235,624856,990384,765081,882662,904407,736845,936829,951387,71373,828148,295778,90800,772491,74522,319028,347997,728147,973880,576106,221759,158549,604199,528596,475540,524529,967798,585473,715517,442455,737849,755938,385077,14391,585638,458185,586475,486545,374221,153184,121673,595645,74496,594415,159574,258983},
                         {46,2116,90811,481594,851614,678888,17941,620104,740488,50892,388992,719883,94772,490139,7074,231793,908728,817178,255794,143660,274772,220184,268530,932846,658984,44650,631494,703852,410906,618456,639217,116886,31351,822291,861522,436839,925516,921777,371281,674407,686173,22726,73878,57955,510361,877498,597230,45676,999791,155578,102550,181780,36975,1305,780112,786826,858666,628365,603502,517297,172879,716633,127429,340538,521577,153394,807294,132939,248596,307132,759570,930694,19684,27986,297860,638595,47289,125688,825137,253600,855169,626292,578322,997354,260106,887644,595394,799066,345633,159816,827694,436124,881609,755781,102467,530626,832136,828522,595312,864981},
                         {56,3136,165661,948300,245091,646926,487804,456808,50892,660595,823364,675437,741063,745960,794860,20093,711519,257174,891612,580212,566622,819486,196850,240312,894522,341501,876343,569433,882648,614615,547745,995832,387487,834988,681521,129207,784714,960202,348209,277062,863009,714950,707241,607578,994098,635073,277054,922749,702252,589677,724744,853078,933584,595788,942070,134700,755345,118459,440699,952293,2164,43487,864498,896628,740128,859022,424925,125181,430102,374371,519568,596534,188254,101631,648220,675825,807337,638347,662887,130257,631405,813671,976873,580823,135209,752415,462412,366429,494339,95361,827468,708527,938971,564449,862501,962208,441299,920913,978561,597297},
                         {67,4489,286177,791333,244338,193281,127548,49812,388992,823364,196319,750779,26750,132492,3752,573787,845285,343915,788033,852835,726066,951679,193918,313468,163059,685374,75251,763819,223905,393500,129153,134431,537176,719237,662018,474460,511137,91869,636697,510399,835356,530112,375505,241691,973755,669263,970497,44525,68173,453876,522605,217074,335707,299324,337270,377673,734370,220224,248586,551878,95076,867239,479551,786780,181278,752496,200174,811162,237284,16595,535308,126738,348392,508904,970907,247989,611478,209018,489157,293167,302587,850223,951324,739928,736319,43013,836858,338530,765570,840142,537547,471064,270096,778899,920969,270910,423150,437050,679102,997712},
                         {79,6241,472369,261052,627109,916181,597181,44529,719883,675437,750779,329938,868852,225798,898745,742711,235348,904213,224114,13195,15267,441261,617783,88218,938415,922003,47645,707765,350161,843418,211278,188247,254514,105776,480802,388832,337589,744334,991092,80411,79541,684864,250006,520913,6823,126665,858521,879633,251929,959543,97039,501235,664125,921896,115443,655671,483970,853865,588080,489604,852587,575357,566887,877163,786447,368447,620594,219444,372568,203181,10459,568145,363453,318242,333264,248900,305152,426646,858157,350774,737074,578807,968015,689468,682245,459300,612501,838299,134934,604743,432684,360664,461191,951645,255393,737271,336880,217218,889463,145071},
                         {92,8464,750205,407035,581314,626250,548897,926241,94772,741063,26750,868852,507550,192353,139653,279062,524633,114688,305865,249793,873922,345908,44465,903340,776542,587043,170893,485413,696830,706754,175620,161157,299529,712103,425465,667849,813960,39571,617551,136245,346054,542125,256808,640761,347528,450781,61298,487984,628007,605601,92557,782424,677984,882578,71905,766050,207842,793955,589912,107323,818436,297202,632182,183562,924264,280002,350067,292929,468169,554251,6619,61287,146771,812672,887469,600277,743604,179827,90773,620498,205891,292421,831259,811787,980629,996386,23488,519262,465860,105068,167129,849812,493900,264910,49112,506821,867290,213275,232736,979676},
                         {106,11236,152708,797530,93002,241339,271723,66306,490139,745960,132492,225798,192353,884008,808299,514046,912390,850562,166898,420316,90297,905603,417299,742296,958825,63750,654966,581229,784442,9781,955652,112092,540836,85738,690084,427648,757916,891079,711261,990461,101413,567318,600273,11655,602883,224298,645028,174097,987311,60050,648779,735556,705663,713780,569599,488174,91947,507475,805295,909445,848033,153653,490690,206077,662089,319044,434647,487604,632524,486955,99421,761259,555675,352854,532032,617898,765818,934798,332491,754143,944289,536793,820625,429250,223968,541894,780688,116044,685799,781262,112286,924965,38585,342613,641936,26437,468019,558425,672899,40793},
                         {121,14641,721058,435235,658598,912723,176185,159867,7074,794860,3752,898745,139653,808299,534510,216116,665996,365177,394605,24630,439792,865038,480301,806440,786630,469703,306958,924358,77267,647520,466100,753416,446279,933883,128947,140955,822643,455341,696563,602348,261602,505355,26328,672334,355711,210541,68653,896052,855526,635322,52217,370725,641090,11343,757093,722147,544408,257179,392757,838749,354920,555653,415418,341536,334733,752284,474983,660433,732436,94442,821104,807541,9097,807648,752981,7397,766934,138661,719711,128184,46388,244932,987174,873629,317427,759812,383090,86255,213030,490300,913847,728981,684737,339209,867361,327022,285856,76079,709593,252208},
                         {137,18769,505971,902184,171376,933581,98747,279092,231793,20093,573787,742711,279062,514046,216116,514741,437307,691932,332836,442690,191586,764107,637714,460079,954550,376528,462351,691777,871221,529834,7186,93198,113181,489742,537861,905764,401921,205198,996600,207291,763089,376740,708640,847183,962068,168330,987357,619288,897542,13655,812868,155481,674693,562815,733597,811888,55092,156684,943357,552476,36338,852133,681058,296075,651860,106175,912249,838993,99050,585765,346636,225808,43448,348359,972124,850510,400728,501507,662832,372688,119872,961644,794543,890949,673598,993672,909472,415212,687030,922853,901220,942705,423189,230122,396257,775731,329258,147578,524213,246107},
                         {154,23716,568930,769206,113529,10257,284236,559843,908728,711519,845285,235348,524633,912390,665996,437307,180367,823643,673586,603348,421325,391599,275091,800142,202169,523450,44824,519223,283170,481390,275319,915329,607964,250909,132083,674731,818455,366093,749492,84371,250775,664962,652944,73264,501775,320579,293247,431565,272666,80797,468974,250738,770780,185436,21511,236557,518686,968726,996459,720630,277034,627077,70951,739192,201262,593927,322081,235675,314235,447057,148108,982728,979473,193801,638788,594588,473512,637610,13021,814143,787596,279164,246232,735477,821909,837652,553346,793753,221078,386784,211998,752620,690207,228862,306592,757376,389028,92213,197279,915468},
                         {172,29584,983693,307434,55332,945986,885731,459933,817178,257174,343915,904213,114688,850562,365177,691932,823643,55815,927883,138107,904440,591257,492533,449142,342169,845244,751377,474047,451535,270085,411652,440515,680134,970071,356727,142867,785471,526519,370335,486930,98116,99151,807677,744264,669081,449109,614697,631840,239560,674399,103631,839692,660055,546854,762028,252106,856488,29836,523305,252504,5773,642406,495753,904303,65581,260471,963867,847933,736530,161827,30196,813138,555658,117274,745903,357464,7421,573220,506563,963432,743290,405168,494967,137882,146355,822152,465205,392608,544692,624636,236810,535885,872886,201380,758234,725203,994170,970804,465089,282723},
                         {191,36481,837823,542456,32550,147659,201236,411631,255794,891612,788033,224114,305865,166898,394605,332836,673586,927883,804350,272433,45594,281902,282104,323862,641856,318395,138327,610630,182252,11842,920905,622999,4946,305367,81956,441023,403276,878886,703308,904568,408613,191440,258982,226165,532616,890291,711639,154525,257752,878820,130442,720039,724960,899005,729192,158009,413419,809379,732018,494067,595769,301317,994784,464742,131663,510753,35334,166226,401335,1728,587269,389406,132305,793618,284785,263414,457666,937880,178903,28577,981393,271961,768474,434849,642895,886773,427533,129897,537730,663972,240245,820574,278013,353071,543377,790704,329107,849778,328119,329802},
                         {211,44521,234274,693880,758625,339019,375688,330272,143660,580212,852835,13195,249793,420316,24630,442690,603348,138107,272433,217857,815837,197796,688667,390742,481619,997295,569149,215697,551329,105582,224885,401573,286871,450405,517106,394321,199275,178456,322397,583135,450669,111334,815486,805802,401706,662921,783408,447161,445781,911185,157185,629532,183581,333224,973351,976668,202307,109402,438392,178960,22182,847637,40381,809708,55150,755791,857822,848363,910098,495276,214864,843908,221527,650555,469543,174215,912634,134820,34794,700935,434988,814590,194793,89987,281196,69812,305349,267014,744784,119267,370040,953588,28684,995541,602269,614791,792416,378914,482458,112148},
                         {232,53824,293101,45571,940712,924184,830703,313146,274772,566622,726066,15267,873922,90297,439792,191586,421325,904440,45594,815837,247551,21117,545875,520302,23574,849077,14124,319590,217104,462889,725104,452240,277230,773241,494438,15957,570433,475115,934992,759278,855700,629505,467882,604496,405005,953088,944237,90060,521049,765836,565395,47087,122083,105397,85252,539088,244055,893406,16260,159193,843143,850171,953264,39496,983220,483303,874065,800310,19479,14281,448965,534301,423949,572878,995168,127778,141166,887769,579857,530899,69831,467889,451752,133081,578172,495817,774861,703238,405547,631922,718337,650713,705387,749009,94739,797918,419205,989775,653278,277880},
                         {254,64516,153311,294508,322404,298871,499876,57216,220184,819486,951679,441261,345908,905603,865038,764107,391599,591257,281902,197796,21117,523744,737957,264186,445387,317200,49701,472940,581902,981091,532951,517167,900843,629868,925051,742647,830459,863568,155017,883783,555813,353825,769240,90557,416679,380016,11765,320643,457987,154744,821663,438935,590274,511022,423276,162107,555207,149890,30341,798118,339762,996530,761495,586263,604570,574535,539404,109231,856890,269224,92250,522706,907703,539942,154065,324618,235274,84518,576032,197689,213435,438739,557211,170484,127459,156941,380966,805775,686795,568453,371813,455441,380901,560307,336533,214292,11958,767422,363718,478311},
                         {254,64516,153311,294508,322404,298871,499876,57216,220184,819486,951679,441261,345908,905603,865038,764107,391599,591257,281902,197796,21117,523744,737957,264186,445387,317200,49701,472940,581902,981091,532951,517167,900843,629868,925051,742647,830459,863568,155017,883783,555813,353825,769240,90557,416679,380016,11765,320643,457987,154744,821663,438935,590274,511022,423276,162107,555207,149890,30341,798118,339762,996530,761495,586263,604570,574535,539404,109231,856890,269224,92250,522706,907703,539942,154065,324618,235274,84518,576032,197689,213435,438739,557211,170484,127459,156941,380966,805775,686795,568453,371813,455441,380901,560307,336533,214292,11958,767422,363718,478311},
                         {301,90601,939843,187488,14366,446044,430691,827872,932846,240312,313468,88218,903340,742296,806440,460079,800142,449142,323862,390742,520302,264186,110287,438372,876047,570914,563255,531831,185913,540992,217160,475666,276526,777101,953026,445190,66855,48150,302544,801759,56864,287421,329535,133182,443676,447021,235657,797417,714322,167738,673836,759035,871929,982497,595831,749672,769212,976975,716227,262885,783859,417563,904484,355562,565780,304076,741320,280634,907176,944234,904133,736888,519614,336423,742647,728346,996489,47720,547933,58689,856516,186339,507706,500218,664696,845191,771947,494995,878088,59055,431522,510021,86640,779858,763960,119308,705345,91513,121802,521603},
                         {326,106276,256229,157840,2811,456409,692079,141052,658984,894522,163059,938415,776542,958825,786630,954550,202169,342169,641856,481619,23574,445387,654211,876047,359604,616489,972524,486168,751445,827063,397508,542483,593357,177852,174386,251963,594471,788318,521349,697026,459085,419655,135931,674053,148674,552204,358447,66295,253593,949464,360269,502321,767230,864037,315189,711905,883643,470027,285412,791982,801782,43788,218431,495232,806307,261561,394864,971155,846889,972712,322086,319819,330590,771886,715338,761769,974093,357229,274533,707837,483880,701599,498263,35584,183789,774375,79081,733372,363961,820102,27245,696819,179317,31178,3367,47097,584770,646315,876239,38191},
                         {352,123904,158288,567960,99582,979197,484018,746587,44650,341501,685374,922003,587043,63750,469703,376528,523450,845244,318395,997295,849077,317200,133,570914,616489,541397,168169,418987,932704,263710,484568,718644,431190,900136,543228,261453,756047,218074,905592,346411,611493,22431,513209,923062,211695,685863,832160,677546,53726,859742,92033,763874,217534,645755,542203,707406,156386,805318,927510,388910,919851,374317,376560,780092,422151,588596,71037,917890,493458,591388,984780,172939,923105,590542,33254,705682,816887,521960,427040,183276,334161,324096,919574,702841,966760,125400,572754,103136,160257,500185,775907,623494,825211,958464,811372,348443,924883,897105,226078,99222},
                         {379,143641,909750,835262,595755,893106,414614,483124,631494,876343,75251,47645,170893,654966,306958,462351,44824,751377,138327,569149,14124,49701,817950,563255,972524,168169,955263,109544,713225,516814,995417,8183,355397,630098,786749,945398,633362,139707,300516,580244,426616,518524,813841,896655,326760,68485,663302,438833,3421,938948,30578,684531,314797,636131,308612,503941,876968,158093,629379,299013,891832,398141,160951,463120,101735,10269,48963,316857,430528,338708,521416,93896,163218,733158,586961,733407,756218,681285,273629,791418,717433,831603,269651,780639,41903,195959,701064,75862,487864,245821,547727,285710,945824,516239,792836,939033,69493,747499,747156,687103},
                         {407,165649,805987,933729,603196,13466,900580,616836,703852,569433,763819,707765,485413,581229,924358,691777,519223,474047,610630,215697,319590,472940,467504,531831,486168,418987,109544,96844,188299,95481,251093,810107,322264,763926,605895,630915,649953,238611,796695,13000,315419,865834,266899,392712,923221,321966,668269,477567,396066,367817,499619,938594,53358,411707,954522,571002,390862,490465,571653,468106,580278,200044,31597,881964,587873,247758,7211,91517,561964,628744,533527,32238,424811,88061,467873,560844,325478,507673,497759,294161,633208,158632,186024,517291,403104,510950,423007,509179,573362,945372,107199,102884,858692,361526,491411,207843,648898,238012,756261,699564},
                         {436,190096,176375,645566,409442,689572,24207,887635,410906,882648,223905,350161,696830,784442,77267,871221,283170,451535,182252,551329,217104,581902,277961,185913,751445,932704,713225,188299,758896,341534,230032,392630,397451,255318,306395,406147,950032,390851,95596,494369,315492,749819,715532,842507,29396,317599,783389,618458,638110,440244,390681,629311,838539,907807,314362,267104,969606,117600,995635,51208,832227,159790,375137,647373,2972,684935,337622,180097,506398,404509,43683,39346,763506,160753,172501,40615,995870,146268,186582,351337,301306,199110,620847,734307,941203,762759,403619,468604,232323,528882,677746,217777,839480,246092,478340,932125,37279,487036,642592,247961},
                         {466,217156,386831,765216,655560,404781,631740,389506,618456,614615,393500,843418,706754,9781,647520,529834,481390,270085,11842,105582,462889,981091,772868,540992,827063,263710,516814,95481,341534,31938,525027,926315,763642,555640,409619,486665,170667,164841,536215,44892,496294,975369,848476,830187,556014,550169,512465,544092,22253,369725,212010,496118,2524,353011,414800,920613,522781,160873,669260,651816,64082,358025,420100,536372,649797,476289,571843,379907,235610,658936,812721,771366,32319,516830,448651,230892,147696,994589,510567,527830,931564,591295,511298,655006,801136,349683,616178,889790,337279,753835,316474,8001,503419,668656,54603,778850,945500,147385,31209,201901},
                         {497,247009,842474,326401,712171,205998,102471,350674,639217,547745,129153,211278,175620,955652,466100,7186,275319,411652,920905,224885,725104,532951,361480,217160,397508,484568,995417,251093,230032,525027,66290,88013,362808,592225,825827,732407,805737,876064,832294,594931,8242,143951,503843,903175,772997,842185,799779,821222,801682,213147,110032,99014,545072,394735,402988,989914,748419,767550,50691,371378,719739,628416,356978,764535,843958,578303,881247,54434,198080,429885,15150,642862,218322,268429,156790,980613,173466,554615,839883,721600,477322,355421,779411,176405,670603,491492,726716,871807,348656,603001,345930,111145,434920,928955,646213,78740,378534,945195,509292,229168},
                         {529,279841,990291,925081,632174,219705,180521,548345,116886,995832,134431,188247,161157,112092,753416,93198,915329,440515,622999,401573,452240,517167,785024,475666,542483,718644,8183,810107,392630,926315,88013,717892,150887,951851,963615,887748,617999,747530,674772,818230,169144,642671,386380,739257,563490,123580,268166,202688,481473,528961,72202,118043,213068,825502,464949,465472,107539,162880,148727,463531,266609,182981,401305,979523,797112,106242,916739,497003,408899,355529,757708,121643,41711,851474,401567,925067,965863,308095,15034,14780,925745,405713,822826,899256,699075,226235,57238,640352,818867,355118,871501,562669,301818,295677,271061,639217,110897,406192,378559,248609},
                         {562,315844,321927,214237,350925,760404,74134,645088,31351,387487,537176,254514,299529,540836,446279,113181,607964,680134,4946,286871,277230,900843,109971,276526,593357,431190,355397,322264,397451,763642,362808,150887,542458,9766,571298,973619,830244,433299,197664,214671,817036,339905,843311,391985,365115,918161,76011,227709,697230,700943,854545,425080,209892,836952,648590,674597,297371,168422,827941,533204,407241,448887,858842,257040,226504,608457,970849,988008,238026,242021,535686,750905,886678,795310,543888,707458,746911,383950,684098,601260,916005,341153,974623,657781,633921,304886,472901,509138,693356,261207,93026,668569,53865,12368,32113,839934,339383,382375,558024,416418},
                         {596,355216,376531,648156,498540,953892,187068,401772,822291,834988,719237,105776,712103,85738,933883,489742,250909,970071,305367,450405,773241,629868,371707,777101,177852,900136,630098,763926,255318,555640,592225,951851,9766,406708,232507,68086,799215,325469,751588,764490,260328,300986,573985,275082,428528,381071,257804,196348,931271,563518,727048,850968,5857,891110,680618,241484,722466,133730,757937,327402,644058,607932,471260,108218,194107,166369,816543,796157,778811,825650,20686,457127,227238,660080,974971,923269,491927,754438,324811,299715,818287,626198,55456,136596,930,501603,684754,472074,934458,455762,752260,791892,193432,150479,444276,641749,718802,548370,303050,660229},
                         {631,398161,743794,557419,398696,262717,600541,683773,861522,681521,662018,480802,425465,690084,128947,537861,132083,356727,81956,517106,494438,925051,606754,953026,174386,543228,786749,605895,306395,409619,825827,963615,571298,232507,692155,846078,217257,879257,239335,609954,552236,179886,48676,502494,188744,914270,549483,385427,518745,125003,254864,27829,587715,913878,252867,864866,968292,919358,726203,110577,764407,630431,466615,258423,296253,720227,173236,141943,116777,31195,625218,164480,727652,341148,912144,709456,696840,537939,878246,844641,658661,263446,976155,492103,785826,191000,860374,772429,367413,372060,25794,251014,784411,394169,799670,116950,151553,984321,277355,322294},
                         {667,444889,66992,637191,666520,718352,215301,132971,436839,129207,474460,388832,667849,427648,140955,905764,674731,142867,441023,394321,15957,742647,127380,445190,251963,261453,945398,630915,406147,486665,732407,887748,973619,68086,846078,964799,593069,967383,956262,317181,296784,983264,751818,82017,472008,415999,533704,236161,747465,670380,66446,720140,204883,746209,701148,312676,441302,34160,304903,55631,514420,60967,487467,973619,875198,415034,61293,181898,980630,604709,545228,847611,792633,201584,292714,186683,245338,719524,325081,331725,115459,569720,381128,340802,308636,679480,452908,589627,145016,542424,575948,159309,948930,302599,113309,390726,701704,615501,914737,860005},
                         {704,495616,46068,934918,399133,441411,255117,363536,925516,784714,511137,337589,813960,757916,822643,401921,818455,785471,403276,199275,570433,830459,775911,66855,594471,756047,633362,649953,950032,170667,805737,617999,830244,799215,217257,593069,957641,86597,835092,462858,222020,559110,711015,392598,390908,610699,4269,711547,44257,582308,735904,876224,237997,556281,510315,244677,861082,221472,603092,701222,927364,910399,280240,64414,58782,313149,176409,175826,717300,823392,475239,977985,719544,316278,235267,162800,120343,860816,973668,306970,378496,781825,813782,115287,126986,226504,660552,350458,361232,971636,855769,927073,327703,675069,356854,5843,416709,309829,929200,430991},
                         {742,550564,440957,425427,388398,564069,358907,414852,921777,960202,91869,744334,39571,891079,455341,205198,366093,526519,878886,178456,475115,863568,486519,48150,788318,218074,139707,238611,390851,164841,876064,747530,433299,325469,879257,967383,86597,341485,399945,448928,919590,431126,318999,757106,643763,483667,930866,367789,535767,208575,295724,834424,198562,88487,749220,402404,956137,436589,640962,181256,362416,510828,739640,799324,159118,936848,604172,469011,49539,799633,406298,218409,171224,935889,698016,851142,57392,372276,348600,728340,435044,8322,590407,232225,837384,513082,947950,854270,446174,846776,830082,392664,315472,586991,519615,736626,800879,807108,182357,715769},
                         {781,609961,74899,264132,191236,830759,544939,414250,371281,348209,636697,991092,617551,711261,696563,996600,749492,370335,703308,322397,934992,155017,614602,302544,521349,905592,300516,796695,95596,536215,832294,674772,197664,751588,239335,956262,835092,399945,212027,294911,396247,594944,414350,571217,950287,139595,272506,137272,843352,523883,370539,248412,846771,877901,480905,795389,470604,990218,607075,401864,607094,498648,785686,709406,468576,341290,477473,717571,146350,614403,997546,925907,849036,563687,868248,751440,494162,533961,488595,446302,348474,162816,10863,658093,643112,243680,103200,612179,894650,146295,797758,170462,70648,699700,889448,120809,394803,771378,385537,461451},
                         {821,674041,837791,811756,380358,770851,197494,940880,674407,277062,510399,80411,136245,990461,602348,207291,84371,486930,904568,583135,759278,883783,139459,801759,697026,346411,580244,13000,494369,44892,594931,818230,214671,764490,609954,317181,462858,448928,294911,82317,544838,935491,47550,871204,713297,399734,59149,86698,696350,1503,723676,337366,813685,417312,136390,663431,969533,96671,54329,809269,552616,688818,157512,286282,530729,401710,293435,541657,746650,587897,896425,355057,832548,235931,55568,403413,265909,829105,715514,995106,871847,87998,734055,955120,575965,639137,486734,391502,924201,725378,584032,79328,133432,886756,223197,12988,991196,859524,517876,873826},
                         {862,743044,689816,526193,982361,685432,301386,120252,686173,863009,835356,79541,346054,101413,261602,763089,250775,98116,408613,450669,855700,555813,720873,56864,459085,611493,426616,315419,315492,496294,8242,169144,817036,260328,552236,296784,222020,919590,396247,544838,450218,837527,931936,687412,615373,137619,725839,420400,398633,364997,21663,233669,796296,268508,206759,982278,51190,990928,791875,514590,313058,147564,567994,979724,290069,454690,950444,81859,19198,638915,264988,431501,30460,627666,540686,429448,305092,58447,816751,880882,403038,621392,84856,263455,449417,76755,48231,852324,889143,847343,761664,297667,888168,766603,900907,895997,447822,228337,911832,405103},
                         {904,817216,664924,819722,102943,967924,901619,313222,22726,714950,530112,684864,542125,567318,505355,376740,664962,99151,191440,111334,629505,353825,509191,287421,419655,22431,518524,865834,749819,975369,143951,642671,339905,300986,179886,983264,559110,431126,594944,935491,837527,802600,983814,568549,82171,174207,339112,853519,711470,977689,369351,173444,178123,716837,268832,640983,576062,598622,223400,94205,527798,32554,844429,58947,426488,665534,826019,798680,431816,216424,892416,946849,546680,383440,738447,351923,735495,322148,898308,95608,665814,496841,984784,938045,363820,390660,92272,117823,600300,770467,46467,785755,586358,913352,560124,643259,65922,661144,347828,683306},
                         {947,896809,874590,982645,154637,97606,82209,703966,73878,707241,375505,250006,256808,600273,26328,708640,652944,807677,258982,815486,467882,769240,530247,329535,135931,513209,813841,266899,715532,848476,503843,386380,843311,573985,48676,751818,711015,318999,414350,47550,931936,983814,492533,224331,335599,550860,697456,978450,161607,650412,830406,230611,787757,758593,481847,607288,63128,775422,441252,208065,381380,827474,341781,732757,630327,947462,454627,272658,537662,177965,940541,643593,268912,503757,544113,488211,440338,277076,369948,133836,725673,922096,559077,307470,721352,529424,233296,537962,7413,885239,676895,371159,559068,325128,649419,528032,167426,369951,101375,487426},
                         {991,982081,511594,276380,54738,514554,798298,528956,57955,607578,241691,520913,640761,11655,672334,847183,73264,744264,226165,805802,604496,90557,157643,133182,674053,923062,896655,392712,842507,830187,903175,739257,391985,275082,502494,82017,392598,757106,571217,871204,687412,568549,224331,78721,398996,125164,269619,2254,157091,372705,770521,383864,119971,947641,977640,856032,18882,452635,78910,493027,65673,3567,537391,203092,618261,273130,170451,809663,200538,581615,28773,828423,40949,286856,826034,963049,435975,855406,78911,578736,903596,165869,358900,674910,757359,573696,596258,904085,912317,188462,263999,336493,595333,101447,921577,952746,376073,396008,622942,508266},
                         {1036,73313,853840,301968,361530,394540,520662,929468,510361,994098,973755,6823,347528,602883,355711,962068,501775,669081,532616,401706,405005,416679,997238,443676,148674,211695,326760,923221,29396,556014,772997,563490,365115,428528,188744,472008,390908,643763,950287,713297,615373,82171,335599,398996,256845,63728,888029,641796,549068,682845,999576,199341,370180,779822,730243,947966,736999,454104,235371,377925,695140,442275,409378,84490,340772,917707,597116,117046,38794,126643,888671,896955,920807,420235,333647,822045,611840,142801,679760,167763,56315,180446,957996,829739,880183,105357,358734,45649,314577,143370,713494,803243,492783,768611,814070,727966,83329,505397,157945,321858},
                         {1082,170741,268401,752473,681870,846226,537979,307097,877498,635073,669263,126665,450781,224298,210541,168330,320579,449109,890291,662921,953088,380016,676278,447021,552204,685863,68485,321966,317599,550169,842185,123580,918161,381071,914270,415999,610699,483667,139595,399734,137619,174207,550860,125164,63728,129578,637201,395361,897947,694043,101149,812011,291014,429250,424606,299867,993187,809938,948165,501002,709290,397781,721205,792898,637653,362746,574009,986877,723852,969151,783803,364692,1753,343534,662325,306963,528726,942655,812859,363680,177639,58348,776304,450197,186366,574688,379643,489252,175588,982792,231078,547036,277646,206413,778720,316921,479681,187316,241201,4807},
                         {1129,274658,215467,659951,923061,359234,294406,26346,597230,277054,970497,858521,61298,645028,68653,987357,293247,614697,711639,783408,944237,11765,254733,235657,358447,832160,663302,668269,783389,512465,799779,268166,76011,257804,549483,533704,4269,930866,272506,59149,725839,339112,697456,269619,888029,637201,885231,467471,831890,313985,508934,919943,918853,655537,947112,809062,873737,146112,527151,533594,706471,590141,818517,352227,317693,647978,467462,874869,468400,837525,696708,402954,359894,150044,821373,568739,146610,707974,714640,802464,262835,377605,481749,187862,773124,446644,763209,183125,69326,71917,455899,222546,911726,557891,230058,19243,51355,224397,695997,507576},
                         {1177,385346,252570,250473,192356,376737,144716,756827,45676,922749,44525,879633,487984,174097,896052,619288,431565,631840,154525,447161,90060,320643,771121,797417,66295,677546,438833,477567,618458,544092,821222,202688,227709,196348,385427,236161,711547,367789,137272,86698,420400,853519,978450,2254,641796,395361,467471,197671,660822,209838,422884,838823,762928,67398,277417,448945,813143,346544,301728,845894,273623,229351,683785,104292,65315,584998,796811,222580,278972,901354,444049,323882,376778,824452,692871,982265,870017,196844,370776,435024,523917,496635,624255,113440,442472,427085,816325,25140,89723,828432,903969,258245,901728,801999,777326,456691,180111,85790,966000,275838},
                         {1226,503093,38780,523173,480403,912903,374741,148180,999791,702252,68173,251929,628007,987311,855526,897542,272666,239560,257752,445781,521049,457987,429234,714322,253593,53726,3421,396066,638110,22253,801682,481473,697230,931271,518745,747465,44257,535767,843352,696350,398633,711470,161607,157091,549068,897947,831890,660822,681691,404394,509555,196529,149188,373155,371442,92490,787864,187916,781195,146108,973898,373794,4838,620583,255395,577764,455237,331482,486311,641011,106008,297819,29437,201846,490820,990759,777839,526754,174449,56005,960715,842039,176046,633783,302631,938829,931606,810075,543720,788733,784087,46556,818774,888064,303712,351429,879014,679769,27795,935035},
                          {1276,628193,339008,671761,814989,243839,146770,329418,155578,589677,453876,959543,605601,60050,635322,13655,80797,674399,878820,911185,765836,154744,694536,167738,949464,859742,938948,367817,440244,369725,213147,528961,700943,563518,125003,670380,582308,208575,523883,1503,364997,977689,650412,372705,682845,694043,313985,209838,404394,311285,931709,372428,428117,93648,233380,80477,277467,977084,980593,431569,507557,139535,260100,210190,70619,812909,826611,425576,513160,567148,932273,972668,818091,952649,346182,479016,432424,121392,873466,647752,572613,542872,401327,319326,606587,686258,391548,40242,914875,150474,941337,877967,249871,708708,197039,503283,177556,608130,540377,949549},
                         {1327,760946,28467,469342,450456,224063,869879,37277,102550,724744,522605,97039,92557,648779,52217,812868,468974,103631,130442,157185,565395,821663,216943,673836,360269,92033,30578,499619,390681,212010,110032,72202,854545,727048,254864,66446,735904,295724,370539,723676,21663,369351,830406,770521,999576,101149,508934,422884,509555,931709,316247,138791,408190,522582,383835,56897,349898,965281,58658,228974,886384,207290,270934,498767,479700,102949,61283,937673,170323,119356,527648,492392,912997,881720,820581,796845,300466,977256,185429,733985,285305,221181,384639,47104,584635,260322,554850,397047,366062,743346,377228,712636,994178,144561,587782,781698,796417,702058,312380,330873},
                         {1379,901658,97104,740140,981516,842311,957912,865657,181780,853078,217074,501235,782424,735556,370725,155481,250738,839692,720039,629532,47087,438935,7926,759035,502321,763874,684531,938594,629311,496118,99014,118043,425080,850968,27829,720140,876224,834424,248412,337366,233669,173444,230611,383864,199341,812011,919943,838823,196529,372428,138791,586609,938713,734984,730629,506294,766441,865628,512122,785151,572941,838084,206358,498485,808930,2486,191273,715400,819444,236212,377431,594551,406709,424713,202540,2140,329636,24678,885649,186960,298508,891159,410783,994809,579153,45804,557435,775670,971884,868771,605887,185907,549398,918996,237272,483650,893329,345763,805065,189220},
                         {1432,50658,654241,44161,149704,611060,972028,570603,36975,933584,335707,664125,677984,705663,641090,674693,770780,660055,724960,183581,122083,590274,304657,871929,767230,217534,314797,53358,838539,2524,545072,213068,209892,5857,587715,204883,237997,198562,846771,813685,796296,178123,787757,119971,370180,291014,918853,762928,149188,428117,408190,938713,807359,93508,974498,79631,922212,213324,648538,758767,659536,531360,806127,402667,670574,253973,788930,835686,178856,156973,2265,877697,759253,577048,677074,132976,242200,650959,181281,456052,497859,79712,945418,534659,270845,408071,149866,49459,255114,649384,396888,659271,810735,758360,979984,40556,752263,578673,204401,781753},
                         {1486,208230,933255,703094,659846,408456,917052,989565,1305,595788,299324,921896,882578,713780,11343,562815,185436,546854,899005,333224,105397,511022,510540,982497,864037,645755,636131,411707,907807,353011,394735,825502,836952,891110,913878,746209,556281,88487,877901,417312,268508,716837,758593,947641,779822,429250,655537,67398,373155,93648,522582,734984,93508,569792,119075,327842,744490,834538,314158,892756,993813,440117,617381,444526,960606,89396,187449,433819,742284,19737,372224,424593,424401,87843,90182,681236,661085,927434,393577,460629,103608,31877,340729,648541,977171,7310,413434,851014,515344,533523,396216,472840,972333,371090,909757,357689,308828,462962,413452,87816},
                         {1541,374715,296331,298898,658038,807853,713264,613235,780112,942070,337270,115443,71905,569599,757093,733597,21511,762028,729192,973351,85252,423276,354365,595831,315189,542203,308612,954522,314362,414800,402988,464949,648590,680618,252867,701148,510315,749220,480905,136390,206759,268832,481847,977640,730243,424606,947112,277417,371442,233380,383835,730629,974498,119075,106856,138167,215837,905508,477941,66473,235829,425701,763169,551863,361791,76368,579982,184213,938981,445525,230501,781887,487950,421566,166916,513045,688407,578206,915978,917182,565077,364631,895002,955972,71276,476748,264268,181777,71558,378050,224784,301787,473215,289695,358306,883109,806395,946102,69296,416141},
                         {1597,550443,239288,778091,751528,799097,887520,624856,786826,134700,377673,655671,766050,488174,722147,811888,236557,252106,158009,976668,539088,162107,439663,749672,711905,707406,503941,571002,267104,920613,989914,465472,674597,241484,864866,312676,244677,402404,795389,663431,982278,640983,607288,856032,947966,299867,809062,448945,92490,80477,56897,506294,79631,327842,138167,401448,768175,431783,893497,684565,725728,593889,608673,919125,910590,58913,921936,283244,452692,505589,387645,225374,981060,734782,295823,894319,763703,687958,573917,775713,854407,290927,322190,159779,545737,247308,40794,12523,542520,244050,56853,514959,320404,302490,700291,204867,796535,591007,703117,331604},
                          {1654,735750,396597,298416,692301,383714,805322,990384,858666,755345,734370,483970,207842,91947,544408,55092,518686,856488,413419,202307,244055,555207,429762,769212,883643,156386,876968,390862,969606,522781,748419,107539,297371,722466,968292,441302,861082,956137,470604,969533,51190,576062,63128,18882,736999,993187,873737,813143,787864,277467,349898,766441,922212,744490,215837,768175,906874,81293,857994,991813,156297,871177,51959,942697,180393,929371,808819,72372,66382,268151,743715,919325,870402,173148,448032,753122,576171,553412,712132,745687,133728,596480,933879,11503,630933,843600,198178,972471,453165,471229,631993,743003,28153,255087,558890,636581,572696,678542,830438,381845},
                         {1712,930978,546387,955923,209526,748745,421830,765081,628365,118459,220224,853865,793955,507475,257179,156684,968726,29836,809379,109402,893406,149890,617354,976975,470027,805318,158093,490465,117600,160873,767550,162880,168422,133730,919358,34160,221472,436589,990218,96671,990928,598622,775422,452635,454104,809938,146112,346544,187916,977084,965281,865628,213324,834538,905508,431783,81293,871133,147151,950262,356167,519142,147564,188354,85881,65257,776398,971618,951109,814586,753088,529336,577095,695145,954474,363741,49218,151713,739931,391535,825087,75410,294982,568506,362084,498977,678812,79738,840379,412985,105136,431093,701742,81471,59805,108468,895068,875201,188700,556056},
                         {1771,136492,615575,534131,77505,691095,637644,882662,603502,440699,248586,588080,589912,805295,392757,943357,996459,523305,732018,438392,16260,30341,81748,716227,285412,927510,629379,571653,995635,669260,50691,148727,827941,757937,726203,304903,603092,640962,607075,54329,791875,223400,441252,78910,235371,948165,527151,301728,781195,980593,58658,512122,648538,314158,477941,893497,857994,147151,659176,603913,519057,64021,171908,576825,332274,989247,3548,646967,589772,382068,799008,224401,885271,276905,541596,720140,966384,490857,825755,123847,904840,538459,94633,330602,782609,547305,302790,377485,722560,995388,705165,267401,840246,818181,888113,204156,885441,330547,816527,797845},
                         {1831,352612,685086,418366,457424,425303,205054,904407,517297,952293,551878,489604,107323,909445,838749,552476,720630,252504,494067,178960,159193,798118,175432,262885,791982,388910,299013,468106,51208,651816,371378,463531,533204,327402,110577,55631,701222,181256,401864,809269,514590,94205,208065,493027,377925,501002,533594,845894,146108,431569,228974,785151,758767,892756,66473,684565,991813,950262,603913,276439,855385,170191,264439,772075,908113,949071,285819,587411,649327,67074,826776,630421,189116,921764,998827,917747,960825,65963,189688,475664,719229,54843,578936,852800,818068,201416,415024,911164,332903,680336,175893,416817,545508,368801,13850,650924,282043,974847,732771,538945},
                         {1892,579715,995163,821928,966666,746124,610758,736845,172879,2164,95076,852587,818436,848033,354920,36338,277034,5773,595769,22182,843143,339762,454367,783859,801782,919851,891832,580278,832227,64082,719739,266609,407241,644058,764407,514420,927364,362416,607094,552616,313058,527798,381380,65673,695140,709290,706471,273623,973898,507557,886384,572941,659536,993813,235829,725728,156297,356167,519057,855385,922386,79361,385991,70568,354573,199708,151030,841371,611006,321704,946391,687478,298223,277748,542282,993154,346477,594373,9255,65152,194922,126052,121330,434115,800521,113737,793618,343785,341970,883230,659617,445311,874966,635498,617564,778230,914543,305823,299801,697793},
                         {1954,818167,950784,472478,922446,232840,387437,936829,716633,43487,867239,575357,297202,153653,555653,852133,627077,642406,301317,847637,850171,996530,44240,417563,43788,374317,398141,200044,159790,358025,628416,182981,448887,607932,630431,60967,910399,510828,498648,688818,147564,32554,827474,3567,442275,397781,590141,229351,373794,139535,207290,838084,531360,440117,425701,593889,871177,519142,64021,170191,79361,799809,225472,841322,950297,242016,789464,853017,30613,867562,854105,766121,790835,196409,886386,186608,958563,64904,53925,529195,608017,293834,782869,923996,60047,660026,529366,107814,245763,524246,594587,576825,551454,516350,758686,446097,873918,353084,636844,195140},
                         {2017,68357,127135,909845,890094,378984,590215,951387,127429,864498,479551,566887,632182,490690,415418,681058,70951,495753,994784,40381,953264,761495,305255,904484,218431,376560,160951,31597,375137,420100,356978,401305,858842,471260,466615,487467,280240,739640,785686,157512,567994,844429,341781,537391,409378,721205,818517,683785,4838,260100,270934,206358,806127,617381,763169,608673,51959,147564,171908,264439,385991,225472,388408,711761,496855,99426,164398,899793,550192,209802,869168,857820,157524,947808,214479,465983,402310,167670,615052,232672,25130,669755,191448,884795,939564,594837,105643,533818,741560,472127,739581,891857,632570,183517,653283,697877,474012,321952,235524,679238},
                         {2081,330629,275156,549228,154150,400176,285711,71373,340538,896628,786780,877163,183562,206077,341536,296075,739192,904303,464742,809708,39496,586263,565952,355562,495232,780092,463120,881964,647373,536372,764535,979523,257040,108218,258423,973619,64414,799324,709406,286282,979724,58947,732757,203092,84490,792898,352227,104292,620583,210190,498767,498485,402667,444526,551863,919125,942697,188354,576825,772075,70568,841322,711761,417637,280848,165655,196982,453791,233490,356504,803165,600497,978481,142847,718864,620174,184274,265116,699470,874877,298196,880256,330353,441149,44190,986830,906410,498842,501559,241493,899662,867774,113442,990725,643176,280207,927263,736892,289158,913927},
                         {2146,605384,327296,665659,135418,274497,755016,828148,521577,740128,181278,786447,924264,662089,334733,651860,201262,65581,131663,55150,983220,604570,665331,565780,806307,422151,101735,587873,2972,649797,843958,797112,226504,194107,296253,875198,58782,159118,468576,530729,290069,426488,630327,618261,340772,637653,317693,65315,255395,70619,479700,808930,670574,960606,361791,910590,180393,85881,332274,908113,354573,950297,496855,280848,811905,62609,378411,718911,692101,305271,700698,683120,893151,825527,314902,355894,145626,676460,373635,883411,651522,112849,604991,595417,761519,295668,377393,179182,637104,1378,56445,828188,716376,188258,343845,282621,894687,735634,792765,6516},
                         {2212,893012,403205,458878,213691,124843,987647,295778,153394,859022,752496,368447,280002,319044,752284,106175,593927,260471,510753,755791,483303,574535,241414,304076,261561,588596,10269,247758,684935,476289,578303,106242,608457,166369,720227,415034,313149,936848,341290,401710,454690,665534,947462,273130,917707,362746,647978,584998,577764,812909,102949,2486,253973,89396,76368,58913,929371,65257,989247,949071,199708,242016,99426,165655,62609,674961,559162,117308,727015,233696,650373,736856,403944,873128,230011,267753,242002,608571,848933,669624,186230,334116,421876,341981,307403,650608,435463,761096,124119,408244,133508,863856,633754,763064,217888,113185,215558,205504,325023,508668},
                         {2279,193926,815601,359577,995859,218089,199907,90800,807294,424925,200174,620594,350067,434647,474983,912249,322081,963867,35334,857822,874065,539404,661113,741320,394864,71037,48963,7211,337622,571843,881247,916739,970849,816543,173236,61293,176409,604172,477473,293435,950444,826019,454627,170451,597116,574009,467462,796811,455237,826611,61283,191273,788930,187449,579982,921936,808819,776398,3548,285819,151030,789464,164398,196982,378411,559162,958385,852218,626765,146832,208477,345677,963744,705961,207034,784930,217112,530174,221835,106027,272022,472302,313038,271037,548367,95744,907493,178341,863957,90194,65729,560419,645126,700905,999599,910739,603680,674294,184385,997726},
                         {2347,508494,76244,741034,907817,17054,120406,772491,132939,125181,811162,219444,292929,487604,660433,838993,235675,847933,166226,848363,800310,109231,540310,280634,971155,917890,316857,91517,180097,379907,54434,497003,988008,796157,141943,181898,175826,469011,717571,541657,81859,798680,272658,809663,117046,986877,874869,222580,331482,425576,937673,715400,835686,433819,184213,283244,72372,971618,646967,587411,841371,853017,899793,453791,718911,117308,852218,542428,660324,653252,523941,370553,174346,445354,632857,366831,843617,361074,550617,77441,163463,579389,16251,539394,95176,833837,171536,737270,719610,403496,838486,441065,968255,162548,866593,609154,546195,426291,263939,865145},
                         {2416,837141,901864,202389,197445,271602,645883,74522,248596,430102,237284,372568,468169,632524,732436,99050,314235,736530,401335,910098,19479,856890,725718,907176,846889,493458,430528,561964,506398,235610,198080,408899,238026,778811,116777,980630,717300,49539,146350,746650,19198,431816,537662,200538,38794,723852,468400,278972,486311,513160,170323,819444,178856,742284,938981,452692,66382,951109,589772,649327,611006,30613,550192,233490,692101,727015,626765,660324,344892,558528,215368,886294,193189,717374,682426,353110,695179,49792,661389,35303,473473,452703,489260,80792,195231,588993,396256,664278,758542,285901,221012,982956,303834,308891,289066,85983,276225,680340,854362,630428},
                         {2486,180298,220451,592283,130241,963467,617621,319028,307132,374371,16595,203181,554251,486955,94442,585765,447057,161827,1728,495276,14281,269224,791846,944234,972712,591388,338708,628744,404509,658936,429885,355529,242021,825650,31195,604709,823392,799633,614403,587897,638915,216424,177965,581615,126643,969151,837525,901354,641011,567148,119356,236212,156973,19737,445525,505589,268151,814586,382068,67074,321704,867562,209802,356504,305271,233696,146832,653252,558528,703384,571503,467418,899160,678505,603809,97133,318786,454496,963114,982790,59332,54207,13159,306251,400466,789670,455058,631147,856716,69917,169690,98520,465070,479975,905704,848199,491688,37128,493859,495347},
                         {2557,538351,177278,944526,450719,891903,760663,347997,759570,519568,535308,10459,6619,99421,821104,346636,148108,30196,587269,214864,448965,92250,968034,904133,322086,984780,521416,533527,43683,812721,15150,757708,535686,20686,625218,545228,475239,406298,997546,896425,264988,892416,940541,28773,888671,783803,696708,444049,106008,932273,527648,377431,2265,372224,230501,387645,743715,753088,799008,826776,946391,854105,869168,803165,700698,650373,208477,523941,215368,571503,976409,501213,283410,662288,261232,669143,7684,9094,496024,560032,493850,882634,825931,459908,168428,15433,409283,924934,528858,644084,79327,568220,518413,370304,814875,280034,272064,652854,859561,199755},
                         {2629,911743,141337,499334,185772,135112,598697,728147,930694,596534,126738,568145,61287,761259,807541,225808,982728,813138,389406,843908,534301,522706,212534,736888,319819,172939,93896,32238,39346,771366,642862,121643,750905,457127,164480,847611,977985,218409,925907,355057,431501,946849,643593,828423,896955,364692,402954,323882,297819,972668,492392,594551,877697,424593,781887,225374,919325,529336,224401,630421,687478,766121,857820,600497,683120,736856,345677,370553,886294,467418,501213,429873,121979,734017,276747,626089,935423,359853,204541,126463,674309,221904,878056,660840,942899,128436,873797,865591,790951,758562,260954,553563,634627,123328,544615,80410,816311,919533,525021,569601},
                         {2702,300923,711661,986705,694160,823540,437452,973880,19684,188254,348392,363453,146771,555675,9097,43448,979473,555658,132305,221527,423949,907703,293426,519614,330590,923105,163218,424811,763506,32319,218322,41711,886678,227238,727652,792633,719544,171224,849036,832548,30460,546680,268912,40949,920807,1753,359894,376778,29437,818091,912997,406709,759253,424401,487950,981060,870402,577095,885271,189116,298223,790835,157524,978481,893151,403944,963744,174346,193189,899160,283410,121979,992530,262606,991816,442755,705553,579180,59198,548500,571238,796300,130312,701627,643376,440219,469227,957776,340119,932924,541345,506592,184753,341444,809406,91615,76463,298443,194233,400479},
                         {2776,706295,723855,350990,632430,326058,499867,576106,27986,101631,508904,318242,812672,352854,807648,348359,193801,117274,793618,650555,572878,539942,916877,336423,771886,590542,733158,88061,160753,516830,268429,851474,795310,660080,341148,201584,316278,935889,563687,235931,627666,383440,503757,286856,420235,343534,150044,824452,201846,952649,881720,424713,577048,87843,421566,734782,173148,695145,276905,921764,277748,196409,947808,142847,825527,873128,705961,445354,717374,678505,662288,734017,262606,927031,142126,54683,96217,388100,358429,175135,840883,519939,593451,827984,298893,415148,202641,637566,278556,273634,929377,812548,416359,293884,565071,96965,430707,357782,500046,864890},
                         {2851,128337,256615,97725,324629,705818,184939,221759,297860,648220,970907,333264,887469,532032,752981,972124,638788,745903,284785,469543,995168,154065,24233,742647,715338,33254,586961,467873,172501,448651,156790,401567,543888,974971,912144,292714,235267,698016,868248,55568,540686,738447,544113,826034,333647,662325,821373,692871,490820,346182,820581,202540,677074,90182,166916,295823,448032,954474,541596,998827,542282,886386,214479,718864,314902,230011,207034,632857,682426,603809,261232,276747,991816,142126,675595,682271,560374,864655,431351,68370,784286,695702,692533,688733,587876,778215,958171,658445,738674,950300,549199,719618,728158,484483,97092,839205,379625,517656,837060,32268},
                         {2927,567465,638388,447126,6198,180158,645657,158549,638595,675825,247989,248900,600277,617898,7397,850510,594588,357464,263414,174215,127778,324618,555306,728346,761769,705682,733407,560844,40615,230892,980613,925067,707458,923269,709456,186683,162800,851142,751440,403413,429448,351923,488211,963049,822045,306963,568739,982265,990759,479016,796845,2140,132976,681236,513045,894319,753122,363741,720140,917747,993154,186608,465983,620174,355894,267753,784930,366831,353110,97133,669143,626089,442755,54683,682271,435814,407441,691434,435682,104972,857312,506193,602062,852772,301206,940177,670209,338339,449180,54287,143478,784674,236818,139583,131504,476015,847343,436487,453294,302172},
                         {3004,24169,454190,480438,672829,229592,911391,604199,47289,807337,611478,305152,743604,765818,766934,400728,473512,7421,457666,912634,141166,235274,800660,996489,974093,816887,756218,325478,995870,147696,173466,965863,746911,491927,696840,245338,120343,57392,494162,265909,305092,735495,440338,435975,611840,528726,146610,870017,777839,432424,300466,329636,242200,661085,688407,763703,576171,49218,966384,960825,346477,958563,402310,184274,145626,242002,217112,843617,695179,318786,7684,935423,705553,96217,560374,407441,921658,572735,981846,927943,904734,187638,591722,748655,675520,510361,368597,830672,981492,518572,211528,704661,103643,942771,615388,905994,514647,396063,827434,533937},
                         {3082,498877,552361,468189,917877,234400,533943,528596,125688,638347,209018,426646,179827,934798,138661,501507,637610,573220,937880,134820,887769,84518,250618,47720,357229,521960,681285,507673,146268,994589,554615,308095,383950,754438,537939,719524,860816,372276,533961,829105,58447,322148,277076,855406,142801,942655,707974,196844,526754,121392,977256,24678,650959,927434,578206,687958,553412,151713,490857,65963,594373,64904,167670,265116,676460,608571,530174,361074,49792,454496,9094,359853,579180,388100,864655,691434,572735,375762,97302,475131,415086,291049,388897,537884,286681,383356,993552,647134,649823,186024,437645,716172,931596,350451,25061,710165,549131,860171,102196,392656},
                         {3161,992074,51563,571971,299321,209954,705968,475540,825137,662887,489157,858157,90773,332491,719711,662832,13021,506563,178903,34794,579857,576032,307275,547933,274533,427040,273629,497759,186582,510567,839883,15034,684098,324811,878246,325081,973668,348600,488595,715514,816751,898308,369948,78911,679760,812859,714640,370776,174449,873466,185429,885649,181281,393577,915978,573917,712132,739931,825755,189688,9255,53925,615052,699470,373635,848933,221835,550617,661389,963114,496024,204541,59198,358429,431351,435682,981846,97302,991729,458614,331259,922901,859385,926147,525440,575566,573990,249630,780992,746884,836886,735135,872280,912314,781890,679943,844198,531158,251968,44899},
                         {3241,504251,347732,113720,553835,846868,978988,524529,253600,130257,293167,350774,620498,754143,128184,372688,814143,963432,28577,700935,530899,197689,630362,58689,707837,183276,791418,294161,351337,527830,721600,14780,601260,299715,844641,331725,306970,728340,446302,995106,880882,95608,133836,578736,167763,363680,802464,435024,56005,647752,733985,186960,456052,460629,917182,775713,745687,391535,123847,475664,65152,529195,232672,874877,883411,669624,106027,77441,35303,982790,560032,126463,548500,175135,68370,104972,927943,475131,458614,337253,757429,371380,906562,572291,942572,885802,694988,520541,425202,88834,751041,572043,796515,192152,982142,562274,338115,874818,52960,480525},
                         {3322,35871,121273,609004,483642,941284,425041,967798,855169,631405,302587,737074,205891,944289,46388,119872,787596,743290,981393,434988,69831,213435,532150,856516,483880,334161,717433,633208,301306,931564,477322,925745,916005,818287,658661,115459,378496,435044,348474,871847,403038,665814,725673,903596,56315,177639,262835,523917,960715,572613,285305,298508,497859,103608,565077,854407,133728,825087,904840,719229,194922,608017,25130,298196,651522,186230,272022,163463,473473,59332,493850,674309,571238,840883,784286,857312,904734,415086,331259,757429,601619,630992,402905,292112,968015,887711,898429,556635,327437,601830,424464,655734,478159,203458,870638,517248,143342,900013,386229,534870},
                         {3404,587403,344175,763603,695017,37491,825682,585473,626292,813671,850223,578807,292421,536793,244932,961644,279164,405168,271961,814590,467889,438739,646070,186339,701599,324096,831603,158632,199110,591295,355421,405713,341153,626198,263446,569720,781825,8322,162816,87998,621392,496841,922096,165869,180446,58348,377605,496635,842039,542872,221181,891159,79712,31877,364631,290927,596480,75410,538459,54843,126052,293834,669755,880256,112849,334116,472302,579389,452703,54207,882634,221904,796300,519939,695702,506193,187638,291049,922901,371380,630992,186476,851704,586979,725900,71387,785532,860515,805234,563586,888404,416867,617498,160176,466173,917168,145673,904011,527816,562201},
                         {3487,159373,287369,634692,680169,105678,776324,715517,578322,976873,951324,968015,831259,820625,987174,794543,246232,494967,768474,194793,451752,557211,392796,507706,498263,919574,269651,186024,620847,511298,779411,822826,974623,55456,976155,381128,813782,590407,10863,734055,84856,984784,559077,358900,957996,776304,481749,624255,176046,401327,384639,410783,945418,340729,895002,322190,933879,294982,94633,578936,121330,782869,191448,330353,604991,421876,313038,16251,489260,13159,825931,878056,130312,593451,692533,602062,591722,388897,859385,906562,402905,851704,521291,898197,551106,798656,94002,386364,658121,819037,69166,856228,193205,794345,613144,769273,77651,396016,539473,771638},
                         {3571,752245,528057,161002,118178,24732,139806,442455,997354,580823,739928,689468,811787,429250,873629,890949,735477,137882,434849,89987,133081,170484,288594,500218,35584,702841,780639,517291,734307,655006,176405,899256,657781,136596,492103,340802,115287,232225,658093,955120,263455,938045,307470,674910,829739,450197,187862,113440,633783,319326,47104,994809,534659,648541,955972,159779,11503,568506,330602,852800,434115,923996,884795,441149,595417,341981,271037,539394,80792,306251,459908,660840,701627,827984,688733,852772,748655,537884,926147,572291,292112,586979,898197,69629,162143,928065,646900,587170,869528,659665,979845,389959,791229}};
    int main()
    {
        freopen("B.in","r",stdin);
        freopen("B.out","w",stdout);
        scanf("%d%d",&n,&m);
        printf("%I64d",ans[n-1][m-1]);
        return 0;
        fclose(stdin);
        fclose(stdout);
    }
    List算法10分不舍得删
    #include<cstring>
    #include<cstdio>
    #define N 110
    #define Mod 9999973
    typedef long long LL;
    int n,m,i,j,k;
    LL f[N][N][N];
    int main()
    {
        scanf("%d%d",&n,&m);
        f[0][0][0]=1;
        for(int i=0;i<n;++i)
         for(int j=0;j<=m;++j)
          for(int k=0;k<=m-j;++k)
           if(f[i][j][k])
           {
               f[i+1][j][k]=(f[i+1][j][k]+f[i][j][k])%Mod;
               f[i+1][j+1][k]=(f[i+1][j+1][k]+f[i][j][k]*(m-j-k))%Mod;
               if(j>=1) f[i+1][j-1][k+1]=(f[i+1][j-1][k+1]+f[i][j][k]*j)%Mod;
               if(m-j-k>=2) f[i+1][j+2][k]=(f[i+1][j+2][k]+f[i][j][k]*((m-j-k)*(m-j-k-1)/2))%Mod;
               if(j>=1&&m-j-k>=1) f[i+1][j][k+1]=(f[i+1][j][k+1]+f[i][j][k]*(j*(m-j-k)))%Mod;
               if(j>=2) f[i+1][j-2][k+2]=(f[i+1][j-2][k+2]+f[i][j][k]*(j*(j-1)/2))%Mod;
           }
        LL ans=0;
        for(int j=0;j<=m;++j)
         for(int k=0;k<=m-j;++k)
          ans=(ans+f[n][j][k])%Mod;
        printf("%lld",ans);
        return 0;
    }
    我们都在命运之湖上荡舟划桨,波浪起伏着而我们无法逃脱孤航。但是假使我们迷失了方向,波浪将指引我们穿越另一天的曙光。
  • 相关阅读:
    Extension Method[下篇]
    Extension Method[上篇]
    科大讯飞和Tizen-TTS语音合成引擎
    c语言中格式化输出函数的研究
    五脏积毒的表现 脸上长痘位置看你健康情况
    Android API Level与sdk版本对照表
    ffmpeg ffprobe ffplay
    sqlite 修改表名,合并数据库(文件)
    Spring配置文件的加载,及装载多个beans.xml文件
    ffmpeg 的tutorial
  • 原文地址:https://www.cnblogs.com/ruojisun/p/7569640.html
Copyright © 2020-2023  润新知