zoukankan      html  css  js  c++  java
  • 2019.9.26模拟赛

    T1序列

    这个题大佬们爆踩std了
    给一个序列,其中一段排序后是某一等比数列子序列,求最长长度。

    怎么做

    数据太水导致枚举公比的过了
    序列中每两个数做商,如果整除了的话,这个商一定是公比的次幂。我们从大到小枚举它是公比的几次幂,从而求到最小的公比。由于(2^{60} > 1^{18}),这个枚举只需要从59开始即可。时间复杂度(O(64n))

    Code

    pow有精损注意判一下。(不要瞎搞手写分数次幂)

    #include <bits/stdc++.h>
    namespace fdata
    {
    inline char nextchar()
    {
        static const int BS = 1 << 21;
        static char buf[BS], *st, *ed;
        if (st == ed)
            ed = buf + fread(st = buf, 1, BS, stdin);
        return st == ed ? -1 : *st++;
    }
    #ifdef lky233
    #define nextchar getchar
    #endif
    template <typename Y>
    inline void poread(Y &ret)
    {
        ret = 0;
        char ch;
        while (!isdigit(ch = nextchar()))
            ;
        do
            ret = ret * 10 + ch - '0';
        while (isdigit(ch = nextchar()));
    }
    #undef nextcar
    } // namespace fdata
    using fdata::poread;
    using namespace std;
    typedef long long ll;
    int n, ans;
    int a[100005];
    ll aa[100005];
    map<long long, bool> mp;
    inline long long pow1(ll a, int b)
    {
        long long res = 1;
        for (; b; b >>= 1)
        {
            if (b & 1)
                res = (long long)res * a;
            a = (long long)a * a;
        }
        return res;
    }
    int main()
    {
    #ifdef lky233
        freopen("seq.in", "r", stdin);
        freopen("seq.out", "w", stdout);
    #endif
        poread(n);
        for (register int i = 1; i <= n; ++i)
            poread(aa[i]);
        ll U, D = 1;
        for (register int i = 1; i <= n; ++i)
        {
            U = aa[i];
            if (U < D)
                swap(U, D);
            if (U % D == 0)
            {
                ll tmp = U / D;
                for (register int j = 60; j; --j)
                {
                    ll t = pow(tmp, 1.0 / j);
                    if (t > 1000)
                        break;
                    if (pow1(t, j) == tmp && t <= 1000)
                    {
                        a[i - 1] = t;
                        break;
                    }
                    if (pow1(t + 1, j) == tmp && t < 1000)
                    {
                        a[i - 1] = t + 1;
                        break;
                    }
                }
            }
            D = aa[i];
        }
        int len = 1;
        for (register int i = 2; i <= n; ++i)
            if (aa[i] == aa[i - 1])
                ++len;
            else
                ans = max(ans, len), len = 1;
        ans = max(ans, len);
        for (register int i = 1; i < n; ++i)
            if (a[i])
            {
                mp.clear();
                mp[aa[i]] = true;
                for (register int j = i; !mp[aa[j + 1]] && a[i] == a[j] && j < n; ++j)
                    ans = max(ans, j - i + 2), mp[aa[j + 1]] = true;
            }
        cerr << ans << endl;
        cout << ans;
    }
    

    T3建造游乐园

    给n个点,建造一个图,使其添加一个边后正好是一个欧拉图。求方案数。

    怎么做?

    首先,我们可以求出欧拉图的方案数,答案是这个方案数乘上(C_n^2)
    至于欧拉图:
    无向连通图 G 是欧拉图,当且仅当 G 不含奇数度结点( G 的所有结点度数为偶数);——from百度百科
    (g[i])表示从i个点随机连边,度数都是偶数的图的所有可行方案数,(f[i] = 2 ^{C_{i -1}^2})。即在i个点中选出一个点,其他点任意连边的方案数。

    证明
    整张图的度数之和是偶数。我们连边时,若剩下的i-1个点有某个点度数为一,则让其向选出来的这个点连边。这样剩下的i-1个点的度数均为偶数,又因为整张图度数为偶数,所以选出来的这个点度数是偶数。故证毕。

    (f[i])是i个点的欧拉图数量。考虑容斥。
    (f[i] = g[i] - displaystylesum_{j = 1}^{i -1}f [j] * g[i-j] * C_{i-1}^{j-1})

    代码

    #include <bits/stdc++.h>
    using namespace std;
    #define int long long
    const int MOD = 1e9 + 7;
    const int MAXN = 2050;
    int jc[MAXN], jcinv[MAXN];
    int f[MAXN], g[MAXN];
    inline int C(const int &n, const int &m)
    {
        return jc[n] * jcinv[m] % MOD * jcinv[n - m] % MOD;
    }
    inline int qpow(int a, int b)
    {
        int res = 1;
        for (; b; b >>= 1)
        {
            if (b & 1)
                res = (a * res) % MOD;
            a = (a * a) % MOD;
        }
        return res;
    }
    inline int sov(int n)
    {
        
        return (f[n] * C(n, 2) % MOD);
    }
    signed main()
    {
        int n = 2000;
        // cin >> n;
        jc[0] = 1;
        jcinv[0] = 1;
        for (register int i = 1; i <= 2000; ++i)
        {
            jc[i] = jc[i - 1] % MOD * i % MOD;
            jcinv[i] = qpow(jc[i], MOD - 2) % MOD;
        }
        for (register int i = 1; i <= n; ++i)
            f[i] = g[i] = qpow(2, C(i - 1, 2));
        for (register int i = 1; i <= n; ++i)
        {
            for (register int j = 1; j < i; ++j)
            {
                f[i] = (f[i] - f[j] * g[i - j] % MOD * C(i - 1, j - 1) % MOD + MOD) % MOD;
            }
        }
        freopen("biao.out", "w", stdout);
        cout << 0 << ",";
        for (register int i = 1; i <= 2000; ++i)
            cout << sov(i) << ",";
    }
    

    打表万能

    #include <bits/stdc++.h>
    using namespace std;
    int ans[] = {
        0,         0,         0,         3,         18,        380,       10800,     558894,    52027416,
        21124449,  486681575, 704694707, 358155953, 203597911, 460665510, 886439192, 988927751, 733376292,
        34193202,  501087611, 870344504, 51243400,  826289084, 286257691, 301699744, 334117440, 504811630,
        480540877, 807081711, 786671192, 130800185, 839019460, 640087842, 971518205, 934407072, 643922887,
        922086327, 218841715, 364493854, 28534180,  242565546, 870695592, 915287932, 662998747, 949114074,
        981932858, 114106712, 652775879, 382778315, 88491882,  56703922,  282518978, 403678752, 15029051,
        502938342, 195827336, 204944448, 609253690, 947286876, 433654466, 166010560, 487854169, 413648807,
        429374148, 120966129, 830928142, 958993004, 530025556, 456866897, 773396193, 666960014, 20061935,
        878049837, 249791236, 807224984, 634235609, 463326233, 609425283, 28685685,  210937573, 171389970,
        588434995, 816425947, 898449526, 845071659, 520738336, 165243039, 755277609, 63573897,  723932216,
        67545829,  235067402, 383731888, 368197448, 290192458, 319059732, 452872174, 585379901, 930280608,
        415647730, 997646203, 737501838, 599986076, 16883260,  574382078, 549561065, 560474646, 7850205,
        633541447, 638579556, 772804435, 156763755, 146976323, 16413788,  710819770, 217352984, 569960447,
        977150345, 673433056, 336079143, 760962765, 896817022, 49054409,  652161900, 534332350, 630677389,
        681025070, 134696357, 464481863, 660833836, 717497608, 96516005,  267820218, 586070679, 109659001,
        844421233, 29015597,  979509690, 808945187, 108734502, 881278656, 168469216, 956344090, 235034067,
        708558640, 862033231, 574176538, 224055339, 807545943, 195283360, 248509197, 138515128, 453902,
        935658368, 534816180, 238914198, 268427203, 612402532, 749501557, 920345643, 446201462, 826055791,
        795513823, 815805296, 453518989, 202718900, 547003911, 439024411, 218221984, 864608856, 544956633,
        242091024, 607761642, 243811311, 290087675, 825953246, 409543119, 388436799, 446676624, 73282611,
        968139795, 854140599, 413854869, 802938510, 697172274, 552560215, 418198369, 580649613, 743745431,
        847237090, 128276116, 38859493,  412210885, 204588642, 618505837, 921082666, 585230435, 100921418,
        366702059, 706358081, 64411006,  162904817, 966784048, 914139106, 501408385, 436374992, 138317296,
        811309380, 347596303, 830279383, 917507232, 548376155, 534605135, 765400806, 817128952, 439587494,
        954325901, 845940283, 487740950, 344140448, 890621600, 346345651, 610122015, 525508146, 916900318,
        554117607, 801967608, 190218717, 171120638, 113684094, 515147362, 932105343, 446257668, 314320566,
        145501045, 366409471, 864010909, 870126777, 462080756, 14859961,  627124291, 715858298, 981496889,
        482386151, 374268886, 750388814, 86259093,  286718681, 592427509, 426874193, 558468265, 556975865,
        332834853, 815563260, 909760832, 151745202, 939905888, 521663074, 525571512, 957811613, 150426168,
        989648817, 246302815, 947414175, 38200551,  165035779, 616929424, 406424460, 767215738, 883179893,
        578928319, 359272106, 568628858, 446643140, 841721460, 985860200, 526113010, 410356294, 749326246,
        363965013, 673239084, 274964712, 876847528, 552040090, 517617265, 956602639, 987655839, 945569314,
        120427067, 345737105, 397994917, 997075475, 783321821, 505738432, 244512999, 91739394,  72364916,
        694620234, 5534983,   875181,    547216413, 596082334, 593262577, 784964269, 249626099, 754854580,
        467493462, 478436502, 99227191,  528437788, 919950845, 700096165, 956617218, 935260843, 924762768,
        777525000, 386412888, 710368771, 377533899, 240954193, 418171379, 476425416, 528744549, 302120438,
        915630247, 36000699,  608339736, 834807823, 645199283, 958455528, 11154367,  616095007, 781434728,
        116499471, 332434788, 710906154, 858934448, 33884865,  37550019,  269660730, 561000231, 156907390,
        100829485, 726710997, 316259223, 728395646, 191587793, 497100772, 8024421,   580491075, 474727038,
        30237852,  217871187, 439806993, 218511557, 293679386, 369968680, 531641806, 26219327,  886899344,
        159550912, 206467831, 841103045, 66626225,  58531480,  855900344, 533506858, 311288790, 782651024,
        280626506, 588694019, 542250916, 691854917, 834251710, 240644248, 123343341, 752441845, 176962003,
        608660814, 246852903, 208901817, 39449724,  49421843,  385157028, 638633176, 549940499, 812160144,
        399883038, 558437490, 924672459, 411861657, 185176843, 404290529, 27591258,  24566821,  464432954,
        776050786, 787717363, 606757067, 882341381, 575124309, 602466613, 269928106, 82356395,  792422795,
        844920314, 875958170, 882720038, 580069309, 943205567, 311433472, 955092516, 931168045, 566623331,
        399915766, 31612802,  941636754, 683028530, 694907790, 765466333, 239835737, 357962512, 674670310,
        717118444, 739707715, 916773452, 151322763, 205720593, 310370257, 824112512, 873432593, 354338436,
        948403980, 844466641, 941215109, 272263005, 685382091, 140173212, 758785493, 433573060, 342056992,
        670149848, 860159381, 983232007, 826428709, 763277692, 207907336, 980713192, 360968816, 484591021,
        899675016, 726439407, 632396105, 208191893, 665758236, 351229274, 109436707, 913160920, 315711880,
        178049961, 506749561, 408826999, 3005208,   66058790,  189362613, 596004784, 455656010, 931104996,
        712405668, 235289100, 85774590,  402651910, 275671923, 715079991, 520711149, 927079772, 140188681,
        177627514, 794253712, 70598369,  613997223, 424738916, 396295441, 695577596, 998985614, 171910992,
        945251764, 417875103, 365178369, 379674568, 628842342, 852393952, 367428498, 941550785, 161553074,
        110054463, 169464789, 262753067, 224309786, 311255965, 587983980, 429897055, 153592496, 148765325,
        117447202, 687977781, 740886031, 53208709,  595137380, 955414385, 609322209, 729816885, 481192837,
        562065334, 427818631, 749135461, 250412637, 116120732, 957532013, 152733819, 384323962, 879332046,
        667184672, 715281145, 971959593, 557686856, 958787345, 891174325, 298396422, 789899121, 952576042,
        746526616, 217920522, 639849570, 530283833, 538535038, 747021334, 508939917, 334649861, 566608947,
        956167960, 209200713, 241562289, 637664479, 97798430,  536348711, 961352339, 707534130, 593508718,
        637198332, 75451326,  413835815, 99551294,  698814167, 601569224, 475212713, 124241938, 703592342,
        710023388, 374217363, 445300859, 437258636, 706748606, 282549708, 326787876, 683150184, 696724528,
        834930107, 549432371, 184544405, 394084732, 869414527, 117271666, 88521417,  452680857, 354183961,
        480988200, 423797122, 302369230, 330180132, 160949429, 593093198, 496008048, 745078679, 669125816,
        850682011, 733795247, 49137994,  846047665, 668530872, 389299916, 200034824, 267742178, 813714149,
        351713960, 848159433, 688126038, 697579261, 781314678, 815713453, 348798856, 152509595, 105892453,
        615883157, 831947533, 194081164, 467630676, 815997335, 871319231, 145234126, 900549145, 3069062,
        487028872, 665934873, 823183656, 216759064, 486419963, 724044452, 732885983, 416344308, 936323583,
        46265555,  61792684,  915787681, 988176424, 912676341, 21747961,  573017401, 982902217, 988495538,
        990851114, 574752400, 756480310, 744637762, 259957808, 234819155, 540837277, 58456834,  675452280,
        951022597, 402716023, 538694701, 552891743, 823427053, 770381845, 924638728, 852942852, 84082714,
        171625957, 444230254, 496800371, 124405928, 524364055, 199359068, 218757866, 666419772, 845607373,
        974697737, 743933980, 180454864, 408519623, 325781774, 957335506, 805908235, 440085735, 710577089,
        875996709, 101841479, 269728251, 832601762, 427213508, 724702311, 531244651, 432964304, 891927298,
        266315934, 647769027, 472863069, 938807782, 203265743, 699802631, 941373007, 801175070, 483646419,
        121943283, 506998537, 26660810,  272751573, 2364238,   192144690, 423610130, 568618929, 852002755,
        888917342, 429720835, 134394439, 515404159, 938756925, 795038105, 243449653, 187799443, 696063207,
        142948641, 992987396, 250645945, 43319374,  160175527, 46848904,  942065920, 460760016, 844837075,
        902041724, 500901714, 155274761, 145425217, 328594938, 151407567, 42431967,  500393859, 264737085,
        342504342, 293942177, 136204874, 897621956, 723421435, 88179916,  15217618,  217149641, 597675442,
        678371934, 991504195, 356919449, 18646634,  356060662, 838043806, 751967997, 855263858, 818632732,
        893680088, 827177007, 503562776, 271471096, 521781219, 724400646, 281073921, 252778562, 267590443,
        10577092,  728860095, 88261063,  387929986, 345125881, 453137396, 55977401,  762733774, 970944029,
        868480076, 50479967,  295249039, 110030152, 674597364, 802660007, 505536876, 481198392, 742427425,
        391839326, 391864411, 939002337, 446107199, 624839622, 115801230, 214048243, 305322501, 52272372,
        29888493,  992425829, 40393867,  851842034, 179456753, 347553866, 180282820, 817281188, 956384888,
        320842896, 694073560, 32270744,  135418069, 537941963, 747498675, 377487695, 207478701, 316845663,
        607541604, 903161505, 691370244, 963356211, 16175093,  92952888,  796783063, 857442642, 2004724,
        453850736, 614928368, 338012925, 774981157, 95005590,  50431592,  700985718, 863155580, 30396405,
        219040273, 17690338,  756936654, 650232968, 959233096, 658576733, 903308746, 462963273, 967325189,
        15207744,  280595138, 83170698,  473890197, 88829212,  998624275, 470166868, 47666716,  345946004,
        80397656,  615766310, 628063384, 37790659,  519718091, 523874948, 282408730, 506033286, 873222086,
        985150079, 165799587, 893112181, 336036908, 892345689, 832087458, 927555483, 633022742, 791785230,
        226842862, 113880945, 984155390, 8439459,   738175849, 846967587, 562928116, 445602516, 734370741,
        557368690, 877012151, 93809274,  961313069, 516456845, 858224944, 959690453, 257409145, 898039391,
        948425871, 713819489, 128305786, 554985015, 747293820, 361818139, 854428434, 738056429, 127513948,
        939663178, 230189056, 584922045, 651951769, 311783219, 770549153, 21744687,  886768733, 164189799,
        452736370, 41519797,  658054657, 780472243, 744432418, 449806890, 858232444, 25909506,  458192686,
        228399854, 875573903, 140292178, 669340007, 134847925, 83445482,  971697378, 820862017, 596912404,
        137315206, 392980523, 410180603, 998266224, 455112271, 31496674,  634504827, 437506140, 198508749,
        332443270, 60648379,  558873702, 827838377, 659592872, 227857922, 976325050, 873218318, 430041538,
        373389954, 982672024, 870922236, 432641359, 206312367, 4156658,   640662412, 551898509, 322166105,
        976773048, 212535117, 66608462,  712236267, 140740712, 828094460, 903494355, 459838086, 930828803,
        642596355, 127257352, 22838830,  150404247, 725255870, 820902076, 880778027, 165015509, 440939035,
        764203597, 777354703, 932673107, 248533451, 869018198, 570542693, 748919848, 165611030, 471112992,
        419363576, 442949793, 878680694, 889421759, 297275043, 383675087, 917847800, 280294180, 286321052,
        196816642, 247174490, 84173129,  468043592, 709539603, 882922478, 870291271, 819152541, 874663263,
        568111535, 629646805, 462872215, 499373916, 934840240, 264232026, 736952243, 799920056, 825333134,
        716881373, 296775408, 690423318, 878934206, 399550227, 698797174, 100292321, 471619008, 155317882,
        333579698, 171711784, 624840964, 805443591, 606667839, 860893755, 527614382, 500326085, 132177891,
        915799257, 744755819, 171288087, 967625120, 869570074, 368721300, 871078175, 576621377, 501573606,
        351389696, 798376576, 55308831,  844254124, 161686452, 82893072,  814563792, 345030302, 536240802,
        403043965, 445429650, 56915473,  478960231, 303888628, 872012145, 853823669, 106293604, 679237733,
        392598788, 728209023, 266301118, 877762662, 572249027, 872549227, 833620100, 46760528,  112944998,
        414033355, 242032641, 551155646, 407015153, 794003403, 911373882, 742841778, 905112027, 705500605,
        274901264, 454531998, 476215444, 225796080, 434674789, 150843958, 644449500, 37970173,  897107290,
        834676189, 975798522, 246630069, 28065217,  811391565, 258614854, 403323933, 782942698, 247538907,
        344377991, 429316621, 851930723, 164015055, 667968952, 198738992, 506957996, 501695840, 118268269,
        248912789, 533455519, 200560443, 42232704,  881309727, 17988987,  926935212, 625698809, 14268348,
        342447595, 602984888, 893574860, 952269676, 961169154, 545241978, 812079715, 392518811, 782501460,
        110844826, 24760627,  736525035, 632749900, 306926736, 578365567, 864817422, 135134585, 371132503,
        492874577, 587333485, 490462578, 379873290, 564052372, 391123683, 913527862, 46108977,  842078805,
        273831904, 824902004, 790993468, 746388084, 231032845, 981580966, 943441603, 337073234, 505770152,
        228264947, 210286195, 234174640, 345412410, 313084113, 383348379, 330733371, 365057898, 796236554,
        747332670, 375115071, 403382508, 81114575,  251167350, 448105967, 16648636,  788671973, 635217634,
        362062803, 257107339, 518864100, 349830063, 307818743, 128896034, 609525548, 953924587, 281252673,
        112986844, 997646331, 649424001, 373462737, 227029869, 718426468, 842478375, 14660171,  250823858,
        409462432, 753094490, 631330560, 285486467, 299616205, 597725024, 44513003,  94409895,  185401405,
        221175821, 506524141, 140189702, 253340483, 854351839, 676103709, 869759539, 764087876, 444956709,
        592826524, 558677644, 398785974, 380412341, 31883892,  157023614, 376173533, 968837577, 356840216,
        565846094, 999308063, 551293952, 561659707, 92538284,  480596363, 474219561, 946777086, 782456787,
        858131715, 21498562,  338843931, 217981358, 394357399, 523714109, 550185056, 929472018, 368239800,
        654078816, 238026458, 519021392, 7077528,   802291537, 584335435, 331185457, 687321983, 844846402,
        622347394, 65997751,  819916563, 693959589, 303823766, 880985691, 832280646, 723486306, 23849595,
        167981396, 333513472, 454316034, 401704824, 937920147, 288958213, 446887926, 442124798, 26887917,
        79030292,  532012156, 973159206, 246180330, 2539609,   155703807, 83447606,  177698797, 157442449,
        202910252, 761638484, 707024237, 488447662, 596954341, 365042693, 293073298, 364679703, 802080282,
        558505793, 403225911, 584830103, 625597651, 972049047, 305064806, 728157252, 662786931, 687055512,
        885654110, 778678886, 239087520, 897928972, 573970000, 730930438, 198927586, 277671323, 454901943,
        158058427, 711093322, 635323954, 893782682, 754865813, 678797653, 442747264, 471556180, 113495652,
        223960863, 38236812,  409054996, 180043357, 288649080, 205931241, 163165400, 199088964, 783984012,
        609571122, 395357506, 80997025,  255597684, 187134886, 840066266, 435334195, 814974671, 179411028,
        238999394, 693551854, 10175473,  657431757, 266040193, 933695248, 893398503, 130519590, 499780670,
        11139180,  681032047, 580760321, 875093244, 196663978, 925022013, 59066422,  272150446, 802308460,
        761246352, 657049041, 861390264, 638610241, 244836478, 914686263, 762363962, 819820610, 735302611,
        471715304, 101977623, 407948580, 913397798, 452443459, 225500005, 903515870, 201485776, 375292262,
        622113989, 935870332, 236457716, 698926591, 756938805, 370746024, 575272277, 280074354, 393753812,
        756057769, 696070979, 258144381, 600766608, 789914647, 937212505, 326229997, 340889761, 544593171,
        191274884, 411463018, 346448385, 89839340,  100008479, 133630825, 853966852, 387518322, 649564887,
        966346722, 857407348, 129769489, 432435360, 540708448, 990231664, 540170474, 81104070,  364149505,
        618180854, 695474810, 142470677, 917749402, 163702297, 7209160,   795475837, 666311536, 509681372,
        846064914, 352038495, 700128818, 256271453, 27589385,  653917108, 861063507, 952110338, 947367748,
        578180877, 849485142, 316563923, 576901497, 382120729, 848262700, 252373604, 326020527, 326709505,
        769377396, 628539420, 44582632,  53894623,  226830769, 198041213, 339625857, 747629276, 720685991,
        823224574, 708037386, 7314579,   223535758, 411300659, 184579148, 670918828, 675017050, 747807522,
        17417316,  929581658, 277500920, 433862696, 267791248, 482585651, 306365257, 152475815, 526649435,
        682083600, 550964874, 895337698, 95828347,  91080783,  910072910, 700146836, 163814988, 217706345,
        997564865, 50527151,  496849632, 916133220, 251956848, 4625739,   73012004,  896448071, 724667223,
        329223674, 372514772, 196179158, 545844298, 208054034, 68407048,  698311849, 399755632, 399465764,
        360496532, 185731424, 197898161, 873607721, 848895782, 546993567, 56623654,  655010261, 80969729,
        452234544, 455625333, 266612710, 872026055, 548813230, 864752788, 941943936, 566470801, 821504042,
        541811555, 945045748, 181046547, 874432836, 105505807, 297064360, 120248995, 801399019, 255055,
        964812538, 972639888, 680813355, 833506146, 23396594,  474025642, 902378439, 174964081, 195212812,
        271447073, 210891930, 489134730, 315113373, 893978176, 336664111, 747430799, 948618776, 136331508,
        201293362, 415193154, 28037567,  986314068, 768406900, 760429476, 177871773, 639957495, 198717577,
        377889724, 223040036, 82498569,  483232581, 865249604, 528467057, 85656298,  456845836, 611195975,
        758981910, 439180223, 78350765,  243464356, 98864748,  318309161, 927484609, 858774311, 420366157,
        974362728, 815864395, 932876194, 918108363, 307230085, 595690017, 115202317, 504291662, 809248520,
        954424435, 515905085, 860579485, 203507720, 351377901, 921831322, 727253266, 505026658, 794111178,
        14276621,  168920883, 639588399, 340017674, 960133731, 542745886, 17226316,  911797500, 544760029,
        937917095, 31135791,  395947418, 947463303, 587037166, 403693590, 387311226, 686753637, 219663178,
        287327329, 208646538, 635941857, 794341503, 784838018, 788099044, 520518571, 466929193, 24684308,
        226222298, 594934279, 285810826, 93693668,  430315817, 849144061, 328997913, 606398575, 23612612,
        464695457, 146499469, 76670677,  533875657, 145526428, 362373676, 457030150, 99494187,  214980231,
        944972633, 182314914, 821759129, 198277700, 657899481, 765511870, 508811589, 942708451, 630134403,
        859491373, 636307728, 986688384, 938996593, 701403823, 198251182, 836824351, 880057308, 253162974,
        982733298, 439357656, 557504194, 345114246, 233249818, 439159614, 893805605, 571475300, 486513406,
        449091892, 429331422, 781834523, 729521939, 791664001, 822714176, 379472772, 41204311,  53855614,
        904516637, 498363948, 612853977, 215134131, 490790497, 633707136, 505990983, 279645715, 392533222,
        95249214,  785351537, 300613808, 538154735, 606084197, 526727952, 724343256, 443841851, 517837412,
        752348252, 725625052, 580162453, 161603418, 280225923, 892576592, 494917390, 353764157, 534358608,
        544198808, 306441240, 482896583, 804669337, 821639965, 90271262,  324199751, 532637089, 866982450,
        497809540, 409191298, 308572325, 411383043, 61167415,  662828537, 27266671,  31563645,  745063280,
        445541110, 44624331,  11380100,  827906863, 399617012, 371648241, 302690954, 582830235, 966801520,
        373858510, 752271492, 671458162, 990956115, 142321744, 851359029, 892400531, 924814665, 237444006,
        637366568, 974198199, 669299709, 1302270,   509577409, 677521340, 864576786, 683774714, 209694656,
        510456158, 471172278, 235004975, 455470273, 762224145, 648129787, 358147077, 504788449, 233596367,
        429229294, 247262304, 712384901, 559840125, 65870926,  497871790, 65869903,  553268758, 337308125,
        588569425, 167853915, 276178840, 698865150, 169318888, 423748227, 155947485, 617641053, 162068804,
        20778421,  512080134, 155679577, 28165824,  545432842, 21126656,  211638708, 441827577, 369399959,
        55112681,  13050863,  841684874, 29937952,  699990320, 164003363, 696056842, 823706744, 555687578,
        927865965, 730760644, 189671119, 630231347, 130547000, 637286082, 700080561, 887253063, 16600821,
        887221493, 184561293, 861037259, 616041121, 232739990, 426234592, 148341858, 677134893, 559589736,
        849226796, 346528746, 15615235,  866580263, 454992808, 47344243,  836273849, 660920179, 971007109,
        952439010, 909283262, 112888496, 91453874,  609077085, 243614614, 902045908, 247891958, 868732418,
        825671436, 233823183, 22698988,  212444621, 779738631, 911166800, 562028986, 435292217, 632154297,
        919190562, 617190884, 808095964, 925683166, 512293806, 376047612, 345162789, 294729455, 856076574,
        547903956, 960208833, 189267270, 144458764, 895009547, 687837251, 815356841, 805881898, 914990147,
        90611183,  441780068, 10276617,  762025292, 984012895, 933822515, 630750466, 978491,    274131602,
        310289745, 656571750, 994710516, 273846400, 605834637, 968272850, 501717191, 526975488, 587655430,
        127497465, 87735679,  477048826, 400116140, 992725546, 673844215, 728310993, 290667060, 699204033,
        166838741, 34096101,  358246753, 438354467, 451669896, 682538381, 639711026, 478448927, 833574950,
        130815248, 450539274, 350290614, 23476711,  246240666, 31437903,  64113790,  921028920, 179753804,
        539858949, 732720473, 191291735, 114219724, 634865632, 335794307, 180058304, 114716288, 80598732,
        422748646, 177963245, 318865863, 23615242,  155528588, 986065175, 236464405, 468865561, 304303139,
        71837431,  31080467,  799346090, 297522789, 228584214, 250384330, 100591819, 621899311, 894620016,
        176753353, 317058677, 265172673, 300129868, 540410251, 439979564, 882869702, 903236917, 826497401,
        961878862, 874420973, 745460405, 415223840, 222829504, 672891604, 372771793, 365576501, 65124992,
        560920232, 852027243, 372712131, 244877869, 214803825, 727900362, 959679204, 306759306, 964737517,
        891815230, 717294602, 458615406, 900057038, 107298139, 635756543, 365247659, 948131611, 872898104,
        249314640, 588293387, 928724341, 513265250, 149332312, 817206405, 957041059, 38904216,  526908048,
        235483887, 816476619, 171352256, 185490015, 504719450, 979062881, 740238735, 646125464, 340218855,
        995480290, 263841704, 325608715, 525755029, 495594412, 174328887, 439031698, 164797141, 76934675,
        197386652, 480365009, 495819516, 879054725, 314573320, 173942407, 850106587, 908894150, 415161106,
        184761077, 251596876, 470166367, 853514617, 67508988,  563384537, 385985039, 987779775, 577590077,
        247964435, 102281083, 4335054,   259890718, 902102570, 402347106, 143337716, 814832590, 102940044,
        19024992,  947499631, 582919234, 209975883, 876443385, 268332586, 456779911, 231204999, 191362434,
        725442675, 232802895, 741535922, 282483235, 741469746, 487802164, 782683468, 552347194, 592823801,
        855128883, 886235681, 13097915,  542464262, 851567801, 82682390,  662552478, 950584943, 125706135,
        482268022, 540892994, 80225481,  118461972, 370047715, 190559878, 449953605, 969265790, 461713336,
        946642070, 950108390, 438189515, 6442109,   269369093, 179828558, 531017006, 32261073,  735294187,
        425807625, 649193904, 849339817
    };
    int main() {
        int n;
        cin >> n;
        cout << ans[n] << endl;
    }
    
  • 相关阅读:
    DS博客作业06--图
    DS博客作业05--树
    DS博客作业03--栈和队列
    DS博客作业02-线性表
    DS博客作业01--日期抽象数据类型设计与实现
    C语言博客作业06---结构体&文件
    C语言博客作业05---指针
    C语言博客作业04--数组
    DS博客作业08--课程总结
    DS博客作业07--查找
  • 原文地址:https://www.cnblogs.com/Shiina-Rikka/p/11602947.html
Copyright © 2011-2022 走看看