{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"write\" class\u003d\"is-node\"\u003e\n \u003cp\u003eTime Limit: 1000MS Memeory Limit:65536KB\u003c/p\u003e\n \u003ch2\u003e\u003ca name\u003d\"header-n3\" class\u003d\"md-header-anchor \"\u003e\u003c/a\u003eDescription\u003c/h2\u003e\n \u003cp\u003e求所有由1-9组成的长度为n的序列逆序对总数。\u003c/p\u003e\n \u003cp\u003e\u0026nbsp;\u003c/p\u003e\n \u003ch2\u003e\u003ca name\u003d\"header-n8\" class\u003d\"md-header-anchor \"\u003e\u003c/a\u003eInput\u003c/h2\u003e\n \u003cp\u003e第1行为输入组数\u003cspan class\u003d\"MathJax_Preview\"\u003e\u003c/span\u003e\u003cspan class\u003d\"MathJax_SVG\" id\u003d\"MathJax-Element-1-Frame\" tabindex\u003d\"-1\" style\u003d\"font-size: 100%; display: inline-block;\"\u003e\n \u003csvg xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" width\u003d\"1.635ex\" height\u003d\"1.877ex\" viewbox\u003d\"0 -755.9 704 808.1\" role\u003d\"img\" focusable\u003d\"false\" style\u003d\"vertical-align: -0.121ex;\"\u003e\n \u003cdefs\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E1-MJMATHI-54\" d\u003d\"M40 437Q21 437 21 445Q21 450 37 501T71 602L88 651Q93 669 101 677H569H659Q691 677 697 676T704 667Q704 661 687 553T668 444Q668 437 649 437Q640 437 637 437T631 442L629 445Q629 451 635 490T641 551Q641 586 628 604T573 629Q568 630 515 631Q469 631 457 630T439 622Q438 621 368 343T298 60Q298 48 386 46Q418 46 427 45T436 36Q436 31 433 22Q429 4 424 1L422 0Q419 0 415 0Q410 0 363 1T228 2Q99 2 64 0H49Q43 6 43 9T45 27Q49 40 55 46H83H94Q174 46 189 55Q190 56 191 56Q196 59 201 76T241 233Q258 301 269 344Q339 619 339 625Q339 630 310 630H279Q212 630 191 624Q146 614 121 583T67 467Q60 445 57 441T43 437H40Z\"\u003e\u003c/path\u003e\n \u003c/defs\u003e\u003cg stroke\u003d\"currentColor\" fill\u003d\"currentColor\" stroke-width\u003d\"0\" transform\u003d\"matrix(1 0 0 -1 0 0)\"\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E1-MJMATHI-54\" x\u003d\"0\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003c/g\u003e\n \u003c/svg\u003e\u003c/span\u003e\u003cscript type\u003d\"math/tex\" id\u003d\"MathJax-Element-1\"\u003eT\u003c/script\u003e。\u003c/p\u003e\n \u003cp\u003e第2—T+1行为长度\u003cspan class\u003d\"MathJax_Preview\"\u003e\u003c/span\u003e\u003cspan class\u003d\"MathJax_SVG\" id\u003d\"MathJax-Element-2-Frame\" tabindex\u003d\"-1\" style\u003d\"font-size: 100%; display: inline-block;\"\u003e\n \u003csvg xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" width\u003d\"1.394ex\" height\u003d\"1.41ex\" viewbox\u003d\"0 -504.6 600 607.1\" role\u003d\"img\" focusable\u003d\"false\" style\u003d\"vertical-align: -0.238ex;\"\u003e\n \u003cdefs\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E2-MJMATHI-6E\" d\u003d\"M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z\"\u003e\u003c/path\u003e\n \u003c/defs\u003e\u003cg stroke\u003d\"currentColor\" fill\u003d\"currentColor\" stroke-width\u003d\"0\" transform\u003d\"matrix(1 0 0 -1 0 0)\"\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E2-MJMATHI-6E\" x\u003d\"0\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003c/g\u003e\n \u003c/svg\u003e\u003c/span\u003e\u003cscript type\u003d\"math/tex\" id\u003d\"MathJax-Element-2\"\u003en\u003c/script\u003e。\u003c/p\u003e\n \u003cp\u003e\u003cspan class\u003d\"MathJax_Preview\"\u003e\u003c/span\u003e\u003cspan class\u003d\"MathJax_SVG\" id\u003d\"MathJax-Element-3-Frame\" tabindex\u003d\"-1\" style\u003d\"font-size: 100%; display: inline-block;\"\u003e\n \u003csvg xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" width\u003d\"22.088ex\" height\u003d\"2.811ex\" viewbox\u003d\"0 -956.9 9510 1210.2\" role\u003d\"img\" focusable\u003d\"false\" style\u003d\"vertical-align: -0.588ex;\"\u003e\n \u003cdefs\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E3-MJMAIN-32\" d\u003d\"M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z\"\u003e\u003c/path\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E3-MJMAIN-2264\" d\u003d\"M674 636Q682 636 688 630T694 615T687 601Q686 600 417 472L151 346L399 228Q687 92 691 87Q694 81 694 76Q694 58 676 56H670L382 192Q92 329 90 331Q83 336 83 348Q84 359 96 365Q104 369 382 500T665 634Q669 636 674 636ZM84 -118Q84 -108 99 -98H678Q694 -104 694 -118Q694 -130 679 -138H98Q84 -131 84 -118Z\"\u003e\u003c/path\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E3-MJMATHI-6E\" d\u003d\"M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z\"\u003e\u003c/path\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E3-MJMAIN-31\" d\u003d\"M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z\"\u003e\u003c/path\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E3-MJMAIN-30\" d\u003d\"M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z\"\u003e\u003c/path\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E3-MJMAIN-2C\" d\u003d\"M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z\"\u003e\u003c/path\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E3-MJMATHI-54\" d\u003d\"M40 437Q21 437 21 445Q21 450 37 501T71 602L88 651Q93 669 101 677H569H659Q691 677 697 676T704 667Q704 661 687 553T668 444Q668 437 649 437Q640 437 637 437T631 442L629 445Q629 451 635 490T641 551Q641 586 628 604T573 629Q568 630 515 631Q469 631 457 630T439 622Q438 621 368 343T298 60Q298 48 386 46Q418 46 427 45T436 36Q436 31 433 22Q429 4 424 1L422 0Q419 0 415 0Q410 0 363 1T228 2Q99 2 64 0H49Q43 6 43 9T45 27Q49 40 55 46H83H94Q174 46 189 55Q190 56 191 56Q196 59 201 76T241 233Q258 301 269 344Q339 619 339 625Q339 630 310 630H279Q212 630 191 624Q146 614 121 583T67 467Q60 445 57 441T43 437H40Z\"\u003e\u003c/path\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E3-MJMAIN-35\" d\u003d\"M164 157Q164 133 148 117T109 101H102Q148 22 224 22Q294 22 326 82Q345 115 345 210Q345 313 318 349Q292 382 260 382H254Q176 382 136 314Q132 307 129 306T114 304Q97 304 95 310Q93 314 93 485V614Q93 664 98 664Q100 666 102 666Q103 666 123 658T178 642T253 634Q324 634 389 662Q397 666 402 666Q410 666 410 648V635Q328 538 205 538Q174 538 149 544L139 546V374Q158 388 169 396T205 412T256 420Q337 420 393 355T449 201Q449 109 385 44T229 -22Q148 -22 99 32T50 154Q50 178 61 192T84 210T107 214Q132 214 148 197T164 157Z\"\u003e\u003c/path\u003e\n \u003c/defs\u003e\u003cg stroke\u003d\"currentColor\" fill\u003d\"currentColor\" stroke-width\u003d\"0\" transform\u003d\"matrix(1 0 0 -1 0 0)\"\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMAIN-32\" x\u003d\"0\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMAIN-2264\" x\u003d\"777\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMATHI-6E\" x\u003d\"1833\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMAIN-2264\" x\u003d\"2711\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003cg transform\u003d\"translate(3767,0)\"\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMAIN-31\"\u003e\u003c/use\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMAIN-30\" x\u003d\"500\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003cg transform\u003d\"translate(1000,392)\"\u003e\n \u003cuse transform\u003d\"scale(0.707)\" xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMAIN-31\"\u003e\u003c/use\u003e\n \u003cuse transform\u003d\"scale(0.707)\" xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMAIN-32\" x\u003d\"500\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003c/g\u003e\n \u003c/g\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMAIN-2C\" x\u003d\"5574\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMATHI-54\" x\u003d\"6018\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMAIN-2264\" x\u003d\"7000\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003cg transform\u003d\"translate(8056,0)\"\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMAIN-31\"\u003e\u003c/use\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMAIN-30\" x\u003d\"500\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003cuse transform\u003d\"scale(0.707)\" xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E3-MJMAIN-35\" x\u003d\"1414\" y\u003d\"555\"\u003e\u003c/use\u003e\n \u003c/g\u003e\n \u003c/g\u003e\n \u003c/svg\u003e\u003c/span\u003e\u003cscript type\u003d\"math/tex\" id\u003d\"MathJax-Element-3\"\u003e2\\leq n\\leq 10^{12},T\\leq10^5\u003c/script\u003e\u003c/p\u003e\n \u003cp\u003e答案模上\u003cstrong\u003e\u003cspan class\u003d\"MathJax_Preview\"\u003e\u003c/span\u003e\u003cspan class\u003d\"MathJax_SVG\" id\u003d\"MathJax-Element-4-Frame\" tabindex\u003d\"-1\" style\u003d\"font-size: 100%; display: inline-block;\"\u003e\n \u003csvg xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" width\u003d\"3.036ex\" height\u003d\"2.299ex\" viewbox\u003d\"0 -938.7 1307.1 990\" role\u003d\"img\" focusable\u003d\"false\" style\u003d\"vertical-align: -0.119ex;\"\u003e\n \u003cdefs\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E4-MJMAIN-32\" d\u003d\"M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z\"\u003e\u003c/path\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E4-MJMAIN-36\" d\u003d\"M42 313Q42 476 123 571T303 666Q372 666 402 630T432 550Q432 525 418 510T379 495Q356 495 341 509T326 548Q326 592 373 601Q351 623 311 626Q240 626 194 566Q147 500 147 364L148 360Q153 366 156 373Q197 433 263 433H267Q313 433 348 414Q372 400 396 374T435 317Q456 268 456 210V192Q456 169 451 149Q440 90 387 34T253 -22Q225 -22 199 -14T143 16T92 75T56 172T42 313ZM257 397Q227 397 205 380T171 335T154 278T148 216Q148 133 160 97T198 39Q222 21 251 21Q302 21 329 59Q342 77 347 104T352 209Q352 289 347 316T329 361Q302 397 257 397Z\"\u003e\u003c/path\u003e\n \u003cpath stroke-width\u003d\"0\" id\u003d\"E4-MJMAIN-34\" d\u003d\"M462 0Q444 3 333 3Q217 3 199 0H190V46H221Q241 46 248 46T265 48T279 53T286 61Q287 63 287 115V165H28V211L179 442Q332 674 334 675Q336 677 355 677H373L379 671V211H471V165H379V114Q379 73 379 66T385 54Q393 47 442 46H471V0H462ZM293 211V545L74 212L183 211H293Z\"\u003e\u003c/path\u003e\n \u003c/defs\u003e\u003cg stroke\u003d\"currentColor\" fill\u003d\"currentColor\" stroke-width\u003d\"0\" transform\u003d\"matrix(1 0 0 -1 0 0)\"\u003e\n \u003cuse xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E4-MJMAIN-32\" x\u003d\"0\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003cg transform\u003d\"translate(500,392)\"\u003e\n \u003cuse transform\u003d\"scale(0.707)\" xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E4-MJMAIN-36\"\u003e\u003c/use\u003e\n \u003cuse transform\u003d\"scale(0.707)\" xmlns:xlink\u003d\"//www.w3.org/1999/xlink\" xlink:href\u003d\"#E4-MJMAIN-34\" x\u003d\"500\" y\u003d\"0\"\u003e\u003c/use\u003e\n \u003c/g\u003e\n \u003c/g\u003e\n \u003c/svg\u003e\u003c/span\u003e\u003cscript type\u003d\"math/tex\" id\u003d\"MathJax-Element-4\"\u003e2^{64}\u003c/script\u003e\u003c/strong\u003e.\u003c/p\u003e\n \u003cp\u003e\u0026nbsp;\u003c/p\u003e\n \u003ch2\u003e\u003ca name\u003d\"header-n19\" class\u003d\"md-header-anchor \"\u003e\u003c/a\u003eOutput\u003c/h2\u003e\n \u003cp\u003e每组样例输出一行。\u003c/p\u003e\n \u003cp\u003e\u0026nbsp;\u003c/p\u003e\n \u003ch2\u003e\u003ca name\u003d\"header-n24\" class\u003d\"md-header-anchor \"\u003e\u003c/a\u003eSample Input\u003c/h2\u003e\n \u003cp\u003e1\u003c/p\u003e\n \u003cp\u003e2\u003c/p\u003e\n \u003cp\u003e\u0026nbsp;\u003c/p\u003e\n \u003ch2\u003e\u003ca name\u003d\"header-n29\" class\u003d\"md-header-anchor \"\u003e\u003c/a\u003eSample Output\u003c/h2\u003e\n \u003cp\u003e36\u003c/p\u003e\n \u003cp\u003e\u0026nbsp;\u003c/p\u003e\n \u003ch2\u003e\u003ca name\u003d\"header-n34\" class\u003d\"md-header-anchor \"\u003e\u003c/a\u003eHint\u003c/h2\u003e\n \u003cp\u003e比如 n等于2时:\u003c/p\u003e\n \u003cp\u003e(2,1),(3,1),(3,2),...(9,8)共36个.\u003c/p\u003e\n\u003c/div\u003e"}}]}