题解

138 条题解

  • 0
    @ 2014-11-04 15:48:55

    不会,写的高精度,居然过了
    #include<iostream>
    #include<cstdio>
    #include<cmath>
    using namespace std;
    int n,sum=0,a[1000002],l=1;
    char t;
    bool isprime(int n)
    {
    if(n==1) return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0) return false;
    return true;
    }
    int wei(int a) {return (int)(log(a)/log(10))+1;}
    int main()
    {
    cin>>n;
    a[0]=1;
    for(int q=n;q>=2;q--)
    {
    for(int i=0;i<l;i++)
    a[i]*=q;
    for(int i=0;i<l+wei(q);i++)
    {
    if(a[i]>=10)
    {
    l++;
    a[i+1]+=a[i]/10;
    a[i]%=10;
    }
    }

    }
    for(int i=0;i<l;i++) sum+=a[i];
    if(isprime(sum)==true) t='T';
    else t='F';
    cout<<sum<<t;
    return 0;
    }

  • 0
    @ 2014-08-18 16:44:13

    type lll=longint;
    arr=array[0..1000] of lll;
    var i,j,k,Base,n:lll;
    st:string;
    res,a,x:arr;
    function F(a,b,n:longint):longint;
    var s:longint;
    begin
    s:=1;
    while b>0 do
    begin
    if odd(b) then
    s:=(s*a) mod n;
    b:=b shr 1;
    a:=(a*a) mod n;
    end;
    exit(s);
    end;
    function P(n,s:longint):boolean;
    var a,i:longint;
    begin
    if n<=1 then exit(false);
    randomize;
    p:=true;
    for i:=1 to s do
    begin
    a:=random(n-1)+1;
    if F(a,n-1,n)<>1 then exit(false);
    end;
    end;
    procedure C(v:longint);
    var rem,o:lll;
    begin
    fillchar(x,sizeof(x),0);
    rem:=0;
    o:=1;
    while (o<=res[0])or(rem>0) do
    begin
    if o<=res[0] then inc(rem,res[o]*v);
    x[o]:=rem mod 10;
    rem:=rem div 10;
    inc(o);
    end;
    x[0]:=o-1;
    while (x[0]>0)and(x[x[0]]=0) do dec(x[0]);
    res:=x;
    end;
    Begin
    readln(st);
    res[0]:=1;
    res[1]:=1;
    val(st,k);
    for i:=2 to k do
    C(i);
    n:=0;
    for i:=1 to res[0] do inc(n,res[i]);
    write(n);
    if P(n,2) then write('T')
    else
    write('F');
    end.

  • 0
    @ 2014-03-18 17:49:48

    此题打表!!!!!!!!!!!!!!!!!!!!!!!!1
    编译成功

    测试数据 #0: Accepted, time = 0 ms, mem = 740 KiB, score = 25
    测试数据 #1: Accepted, time = 0 ms, mem = 740 KiB, score = 25
    测试数据 #2: Accepted, time = 0 ms, mem = 740 KiB, score = 25
    测试数据 #3: Accepted, time = 0 ms, mem = 740 KiB, score = 25
    Accepted, time = 0 ms, mem = 740 KiB, score = 100

    var
    a:longint;
    begin
    read(a);
    case a of
    1:write('1T');
    2:write('2T');
    3:write('6F');
    4:write('6F');
    5:write('3T');
    6:write('9F');
    7:write('9F');
    8:write('9F');
    9:write('27F');
    10:write('27F');
    11:write('36F');
    12:write('27F');
    13:write('27F');
    14:write('45F');
    15:write('45F');
    16:write('63F');
    17:write('63F');
    18:write('54F');
    19:write('45F');
    20:write('54F');
    21:write('63F');
    22:write('72F');
    23:write('99F');
    24:write('81F');
    25:write('72F');
    26:write('81F');
    27:write('108F');
    28:write('90F');
    29:write('126F');
    30:write('117F');
    31:write('135F');
    32:write('108F');
    33:write('144F');
    34:write('144F');
    35:write('144F');
    36:write('171F');
    37:write('153F');
    38:write('108F');
    39:write('189F');
    40:write('189F');
    41:write('144F');
    42:write('189F');
    43:write('180F');
    44:write('216F');
    45:write('207F');
    46:write('216F');
    47:write('225F');
    48:write('234F');
    49:write('225F');
    50:write('216F');
    51:write('198F');
    52:write('279F');
    53:write('279F');
    54:write('261F');
    55:write('279F');
    56:write('333F');
    57:write('270F');
    58:write('288F');
    59:write('324F');
    60:write('288F');
    61:write('315F');
    62:write('306F');
    63:write('333F');
    64:write('324F');
    65:write('351F');
    66:write('351F');
    67:write('369F');
    68:write('342F');
    69:write('351F');
    70:write('459F');
    71:write('423F');
    72:write('432F');
    73:write('315F');
    74:write('378F');
    75:write('432F');
    76:write('441F');
    77:write('432F');
    78:write('423F');
    79:write('441F');
    80:write('450F');
    81:write('486F');
    82:write('477F');
    83:write('486F');
    84:write('477F');
    85:write('414F');
    86:write('495F');
    87:write('495F');
    88:write('531F');
    89:write('549F');
    90:write('585F');
    91:write('594F');
    92:write('540F');
    93:write('513F');
    94:write('549F');
    95:write('585F');
    96:write('648F');
    97:write('648F');
    98:write('639F');
    99:write('648F');
    100:write('648F');
    101:write('639F');
    102:write('630F');
    103:write('621F');
    104:write('702F');
    105:write('648F');
    106:write('639F');
    107:write('594F');
    108:write('666F');
    109:write('657F');
    110:write('657F');
    111:write('693F');
    112:write('765F');
    113:write('666F');
    114:write('648F');
    115:write('648F');
    116:write('729F');
    117:write('738F');
    118:write('756F');
    119:write('774F');
    120:write('783F');
    121:write('774F');
    122:write('738F');
    123:write('765F');
    124:write('747F');
    125:write('855F');
    126:write('801F');
    127:write('873F');
    128:write('828F');
    129:write('819F');
    130:write('864F');
    131:write('927F');
    132:write('873F');
    133:write('846F');
    134:write('846F');
    135:write('819F');
    136:write('864F');
    137:write('927F');
    138:write('954F');
    139:write('981F');
    140:write('954F');
    141:write('963F');
    142:write('1026F');
    143:write('936F');
    144:write('1017F');
    145:write('972F');
    146:write('1017F');
    147:write('954F');
    148:write('1008F');
    149:write('1107F');
    150:write('1053F');
    151:write('990F');
    152:write('990F');
    153:write('999F');
    154:write('1062F');
    155:write('1053F');
    156:write('1098F');
    157:write('1125F');
    158:write('1134F');
    159:write('1089F');
    160:write('1107F');
    161:write('1134F');
    162:write('1125F');
    163:write('1134F');
    164:write('1098F');
    165:write('1116F');
    166:write('1188F');
    167:write('1089F');
    168:write('1188F');
    169:write('1188F');
    170:write('1179F');
    171:write('1242F');
    172:write('1215F');
    173:write('1206F');
    174:write('1215F');
    175:write('1233F');
    176:write('1215F');
    177:write('1278F');
    178:write('1368F');
    179:write('1260F');
    180:write('1305F');
    181:write('1323F');
    182:write('1287F');
    183:write('1314F');
    184:write('1323F');
    185:write('1260F');
    186:write('1296F');
    187:write('1377F');
    188:write('1422F');
    189:write('1386F');
    190:write('1350F');
    191:write('1422F');
    192:write('1404F');
    193:write('1458F');
    194:write('1395F');
    195:write('1413F');
    196:write('1422F');
    197:write('1512F');
    198:write('1395F');
    199:write('1413F');
    200:write('1404F');
    201:write('1350F');
    202:write('1404F');
    203:write('1476F');
    204:write('1494F');
    205:write('1530F');
    206:write('1584F');
    207:write('1647F');
    208:write('1602F');
    209:write('1530F');
    210:write('1548F');
    211:write('1512F');
    212:write('1593F');
    213:write('1530F');
    214:write('1674F');
    215:write('1674F');
    216:write('1575F');
    217:write('1638F');
    218:write('1665F');
    219:write('1575F');
    220:write('1701F');
    221:write('1692F');
    222:write('1665F');
    223:write('1701F');
    224:write('1773F');
    225:write('1728F');
    226:write('1728F');
    227:write('1656F');
    228:write('1638F');
    229:write('1701F');
    230:write('1746F');
    231:write('1665F');
    232:write('1809F');
    233:write('1728F');
    234:write('1872F');
    235:write('1746F');
    236:write('1755F');
    237:write('1890F');
    238:write('1818F');
    239:write('1818F');
    240:write('1926F');
    241:write('1890F');
    242:write('1971F');
    243:write('1980F');
    244:write('1863F');
    245:write('1944F');
    246:write('1827F');
    247:write('1872F');
    248:write('1935F');
    249:write('1881F');
    250:write('1953F');
    251:write('1926F');
    252:write('1917F');
    253:write('2025F');
    254:write('1926F');
    255:write('1899F');
    256:write('1989F');
    257:write('1953F');
    258:write('1863F');
    259:write('1971F');
    260:write('1962F');
    261:write('2079F');
    262:write('2088F');
    263:write('2061F');
    264:write('1953F');
    265:write('2106F');
    266:write('2124F');
    267:write('2043F');
    268:write('2133F');
    269:write('2106F');
    270:write('2151F');
    271:write('2169F');
    272:write('2133F');
    273:write('1980F');
    274:write('2088F');
    275:write('2187F');
    276:write('2043F');
    277:write('2313F');
    278:write('2367F');
    279:write('2223F');
    280:write('2241F');
    281:write('2367F');
    282:write('2340F');
    283:write('2349F');
    284:write('2241F');
    285:write('2304F');
    286:write('2313F');
    287:write('2385F');
    288:write('2322F');
    289:write('2385F');
    290:write('2313F');
    291:write('2331F');
    292:write('2412F');
    293:write('2385F');
    294:write('2358F');
    295:write('2511F');
    296:write('2484F');
    297:write('2394F');
    298:write('2376F');
    299:write('2448F');
    300:write('2466F');
    301:write('2376F');
    302:write('2511F');
    303:write('2493F');
    304:write('2394F');
    305:write('2529F');
    306:write('2457F');
    307:write('2466F');
    308:write('2430F');
    309:write('2412F');
    310:write('2646F');
    311:write('2556F');
    312:write('2565F');
    313:write('2502F');
    314:write('2601F');
    315:write('2556F');
    316:write('2637F');
    317:write('2574F');
    318:write('2655F');
    319:write('2583F');
    320:write('2700F');
    321:write('2628F');
    322:write('2808F');
    323:write('2637F');
    324:write('2610F');
    325:write('2700F');
    326:write('2727F');
    327:write('2682F');
    328:write('2718F');
    329:write('2754F');
    330:write('2655F');
    331:write('2772F');
    332:write('2853F');
    333:write('2862F');
    334:write('2835F');
    335:write('2790F');
    336:write('2907F');
    337:write('2817F');
    338:write('2925F');
    339:write('2817F');
    340:write('2754F');
    341:write('2961F');
    342:write('2835F');
    343:write('2844F');
    344:write('2844F');
    345:write('2916F');
    346:write('2808F');
    347:write('2844F');
    348:write('2970F');
    349:write('2934F');
    350:write('2952F');
    351:write('2862F');
    352:write('3123F');
    353:write('2844F');
    354:write('2925F');
    355:write('3069F');
    356:write('2952F');
    357:write('2979F');
    358:write('2979F');
    359:write('3087F');
    360:write('3024F');
    361:write('2997F');
    362:write('3060F');
    363:write('3060F');
    364:write('3087F');
    365:write('3114F');
    366:write('3024F');
    367:write('3033F');
    368:write('3132F');
    369:write('3204F');
    370:write('3186F');
    371:write('3213F');
    372:write('3195F');
    373:write('3258F');
    374:write('3186F');
    375:write('3159F');
    376:write('3249F');
    377:write('3186F');
    378:write('3132F');
    379:write('3312F');
    380:write('3240F');
    381:write('3195F');
    382:write('3204F');
    383:write('3357F');
    384:write('3339F');
    385:write('3375F');
    386:write('3366F');
    387:write('3204F');
    388:write('3348F');
    389:write('3366F');
    390:write('3321F');
    391:write('3384F');
    392:write('3474F');
    393:write('3312F');
    394:write('3348F');
    395:write('3312F');
    396:write('3582F');
    397:write('3429F');
    398:write('3528F');
    399:write('3627F');
    400:write('3402F');
    401:write('3339F');
    402:write('3366F');
    403:write('3483F');
    404:write('3474F');
    405:write('3600F');
    406:write('3528F');
    407:write('3609F');
    408:write('3465F');
    409:write('3483F');
    410:write('3447F');
    411:write('3573F');
    412:write('3672F');
    413:write('3600F');
    414:write('3654F');
    415:write('3708F');
    416:write('3618F');
    417:write('3726F');
    418:write('3708F');
    419:write('3564F');
    420:write('3672F');
    421:write('3807F');
    422:write('3690F');
    423:write('3627F');
    424:write('3636F');
    425:write('3780F');
    426:write('3618F');
    427:write('3753F');
    428:write('3636F');
    429:write('3762F');
    430:write('3807F');
    431:write('3798F');
    432:write('3897F');
    433:write('3771F');
    434:write('3834F');
    435:write('3879F');
    436:write('3780F');
    437:write('3780F');
    438:write('4059F');
    439:write('3807F');
    440:write('3726F');
    441:write('3852F');
    442:write('3861F');
    443:write('3753F');
    444:write('4041F');
    445:write('3969F');
    446:write('3825F');
    447:write('3978F');
    448:write('4023F');
    449:write('4185F');
    450:write('3825F');
    451:write('3888F');
    452:write('4059F');
    453:write('4203F');
    454:write('4140F');
    455:write('4059F');
    456:write('4176F');
    457:write('4176F');
    458:write('4149F');
    459:write('3969F');
    460:write('4077F');
    461:write('4131F');
    462:write('4158F');
    463:write('4221F');
    464:write('4041F');
    465:write('4194F');
    466:write('4275F');
    467:write('4140F');
    468:write('4257F');
    469:write('4140F');
    470:write('4275F');
    471:write('4338F');
    472:write('4284F');
    473:write('4266F');
    474:write('4419F');
    475:write('4428F');
    476:write('4383F');
    477:write('4194F');
    478:write('4356F');
    479:write('4365F');
    480:write('4356F');
    481:write('4059F');
    482:write('4320F');
    483:write('4266F');
    484:write('4302F');
    485:write('4383F');
    486:write('4329F');
    487:write('4536F');
    488:write('4509F');
    489:write('4419F');
    490:write('4284F');
    491:write('4410F');
    492:write('4608F');
    493:write('4302F');
    494:write('4455F');
    495:write('4464F');
    496:write('4374F');
    497:write('4644F');
    498:write('4527F');
    499:write('4608F');
    500:write('4599F');
    501:write('4446F');
    502:write('4518F');
    503:write('4536F');
    504:write('4671F');
    505:write('4644F');
    506:write('4527F');
    507:write('4581F');
    508:write('4671F');
    509:write('4707F');
    510:write('4644F');
    511:write('4554F');
    512:write('4635F');
    513:write('4761F');
    514:write('4563F');
    515:write('4716F');
    516:write('4698F');
    517:write('4779F');
    518:write('4860F');
    519:write('4752F');
    520:write('4761F');
    521:write('4680F');
    522:write('4698F');
    523:write('4842F');
    524:write('4815F');
    525:write('4860F');
    526:write('4761F');
    527:write('4968F');
    528:write('4986F');
    529:write('4941F');
    530:write('4977F');
    531:write('4950F');
    532:write('4923F');
    533:write('4896F');
    534:write('4932F');
    535:write('4851F');
    536:write('4977F');
    537:write('4797F');
    538:write('4986F');
    539:write('4869F');
    540:write('5202F');
    541:write('5067F');
    542:write('5085F');
    543:write('4941F');
    544:write('4968F');
    545:write('5076F');
    546:write('5112F');
    547:write('5274F');
    548:write('5121F');
    549:write('4923F');
    550:write('5139F');
    551:write('4860F');
    552:write('5337F');
    553:write('4950F');
    554:write('5067F');
    555:write('5193F');
    556:write('5409F');
    557:write('5166F');
    558:write('5247F');
    559:write('5346F');
    560:write('5139F');
    561:write('5274F');
    562:write('5202F');
    563:write('5373F');
    564:write('5265F');
    565:write('5391F');
    566:write('5301F');
    567:write('5337F');
    568:write('5472F');
    569:write('5319F');
    570:write('5265F');
    571:write('5427F');
    572:write('5400F');
    573:write('5427F');
    574:write('5364F');
    575:write('5346F');
    576:write('5337F');
    577:write('5454F');
    578:write('5265F');
    579:write('5400F');
    580:write('5373F');
    581:write('5499F');
    582:write('5562F');
    583:write('5382F');
    584:write('5427F');
    585:write('5292F');
    586:write('5706F');
    587:write('5562F');
    588:write('5499F');
    589:write('5526F');
    590:write('5562F');
    591:write('5652F');
    592:write('5562F');
    593:write('5679F');
    594:write('5328F');
    595:write('5616F');
    596:write('5724F');
    597:write('5787F');
    598:write('5697F');
    599:write('5634F');
    600:write('5715F');
    601:write('5634F');
    602:write('5760F');
    603:write('5787F');
    604:write('5589F');
    605:write('5742F');
    606:write('5661F');
    607:write('5499F');
    608:write('5823F');
    609:write('5931F');
    610:write('5823F');
    611:write('5877F');
    612:write('5823F');
    613:write('5787F');
    614:write('5832F');
    615:write('5841F');
    616:write('5850F');
    617:write('5886F');
    618:write('5778F');
    619:write('5841F');
    620:write('5922F');
    621:write('6039F');
    622:write('5859F');
    623:write('6003F');
    624:write('5931F');
    625:write('5958F');
    626:write('6120F');
    627:write('5895F');
    628:write('5904F');
    629:write('5904F');
    630:write('6057F');
    631:write('6012F');
    632:write('5931F');
    633:write('5967F');
    634:write('6147F');
    635:write('5859F');
    636:write('5859F');
    637:write('6237F');
    638:write('6210F');
    639:write('6336F');
    640:write('6057F');
    641:write('6291F');
    642:write('6021F');
    643:write('6291F');
    644:write('6021F');
    645:write('6219F');
    646:write('6156F');
    647:write('6282F');
    648:write('6012F');
    649:write('6372F');
    650:write('6300F');
    651:write('6399F');
    652:write('6372F');
    653:write('6282F');
    654:write('6246F');
    655:write('6291F');
    656:write('6318F');
    657:write('6219F');
    658:write('6453F');
    659:write('6192F');
    660:write('6516F');
    661:write('6408F');
    662:write('6444F');
    663:write('6147F');
    664:write('6417F');
    665:write('6381F');
    666:write('6327F');
    667:write('6498F');
    668:write('6462F');
    669:write('6453F');
    670:write('6363F');
    671:write('6489F');
    672:write('6417F');
    673:write('6480F');
    674:write('6615F');
    675:write('6453F');
    676:write('6561F');
    677:write('6831F');
    678:write('6444F');
    679:write('6444F');
    680:write('6444F');
    681:write('6417F');
    682:write('6534F');
    683:write('6687F');
    684:write('6786F');
    685:write('6651F');
    686:write('6687F');
    687:write('6615F');
    688:write('6777F');
    689:write('6795F');
    690:write('6876F');
    691:write('6966F');
    692:write('6957F');
    693:write('6669F');
    694:write('6822F');
    695:write('6831F');
    696:write('6696F');
    697:write('6741F');
    698:write('6957F');
    699:write('6885F');
    700:write('6723F');
    701:write('6777F');
    702:write('6741F');
    703:write('6849F');
    704:write('6840F');
    705:write('6678F');
    706:write('6849F');
    707:write('6831F');
    708:write('6957F');
    709:write('7065F');
    710:write('7056F');
    711:write('7092F');
    712:write('6966F');
    713:write('6876F');
    714:write('7083F');
    715:write('6912F');
    716:write('7191F');
    717:write('7101F');
    718:write('7020F');
    719:write('7191F');
    720:write('7164F');
    721:write('6957F');
    722:write('7110F');
    723:write('7047F');
    724:write('7092F');
    725:write('6957F');
    726:write('7083F');
    727:write('7182F');
    728:write('7407F');
    729:write('7065F');
    730:write('7254F');
    731:write('7137F');
    732:write('7254F');
    733:write('7155F');
    734:write('7155F');
    735:write('7128F');
    736:write('7515F');
    737:write('7317F');
    738:write('7029F');
    739:write('7461F');
    740:write('7263F');
    741:write('7218F');
    742:write('7425F');
    743:write('7317F');
    744:write('7326F');
    745:write('7362F');
    746:write('7641F');
    747:write('7452F');
    748:write('7263F');
    749:write('7380F');
    750:write('7416F');
    751:write('7263F');
    752:write('7398F');
    753:write('7524F');
    754:write('7533F');
    755:write('7308F');
    756:write('7524F');
    757:write('7452F');
    758:write('7488F');
    759:write('7434F');
    760:write('7461F');
    761:write('7488F');
    762:write('7353F');
    763:write('7731F');
    764:write('7470F');
    765:write('7641F');
    766:write('7461F');
    767:write('7272F');
    768:write('7542F');
    769:write('7569F');
    770:write('7713F');
    771:write('7704F');
    772:write('7767F');
    773:write('7551F');
    774:write('7776F');
    775:write('7596F');
    776:write('7722F');
    777:write('7875F');
    778:write('7659F');
    779:write('7686F');
    780:write('7659F');
    781:write('7677F');
    782:write('7776F');
    783:write('7686F');
    784:write('7983F');
    785:write('7857F');
    786:write('7938F');
    787:write('8001F');
    788:write('7839F');
    789:write('7965F');
    790:write('7929F');
    791:write('8109F');
    792:write('7812F');
    793:write('7938F');
    794:write('8001F');
    795:write('8001F');
    796:write('8091F');
    797:write('8100F');
    798:write('7884F');
    799:write('8001F');
    800:write('7929F');
    801:write('7965F');
    802:write('7947F');
    803:write('8127F');
    804:write('7947F');
    805:write('7965F');
    806:write('7812F');
    807:write('8028F');
    808:write('8217F');
    809:write('8208F');
    810:write('8181F');
    811:write('8280F');
    812:write('8028F');
    813:write('8037F');
    814:write('8298F');
    815:write('8172F');
    816:write('8424F');
    817:write('8127F');
    818:write('8235F');
    819:write('8001F');
    820:write('8163F');
    821:write('8307F');
    822:write('8496F');
    823:write('8181F');
    824:write('8172F');
    825:write('8415F');
    826:write('8343F');
    827:write('8424F');
    828:write('8217F');
    829:write('8361F');
    830:write('8397F');
    831:write('8433F');
    832:write('8307F');
    833:write('8649F');
    834:write('8352F');
    835:write('8370F');
    836:write('8514F');
    837:write('8514F');
    838:write('8082F');
    839:write('8568F');
    840:write('8316F');
    841:write('8370F');
    842:write('8478F');
    843:write('8649F');
    844:write('8658F');
    845:write('8541F');
    846:write('8550F');
    847:write('8388F');
    848:write('8622F');
    849:write('8586F');
    850:write('8586F');
    851:write('8595F');
    852:write('8649F');
    853:write('8550F');
    854:write('8694F');
    855:write('8685F');
    856:write('8694F');
    857:write('8676F');
    858:write('8685F');
    859:write('8793F');
    860:write('8667F');
    861:write('8802F');
    862:write('8757F');
    863:write('8901F');
    864:write('8937F');
    865:write('8694F');
    866:write('8946F');
    867:write('8820F');
    868:write('8829F');
    869:write('9000F');
    870:write('9009F');
    871:write('9009F');
    872:write('8955F');
    873:write('8811F');
    874:write('8883F');
    875:write('8928F');
    876:write('8928F');
    877:write('8982F');
    878:write('8757F');
    879:write('8901F');
    880:write('9090F');
    881:write('8973F');
    882:write('9117F');
    883:write('8946F');
    884:write('8838F');
    885:write('9099F');
    886:write('9189F');
    887:write('9099F');
    888:write('9072F');
    889:write('8811F');
    890:write('9054F');
    891:write('9054F');
    892:write('8865F');
    893:write('9063F');
    894:write('9126F');
    895:write('9189F');
    896:write('9135F');
    897:write('9045F');
    898:write('9216F');
    899:write('9090F');
    900:write('9324F');
    901:write('9162F');
    902:write('9324F');
    903:write('9081F');
    904:write('9045F');
    905:write('9414F');
    906:write('9153F');
    907:write('9369F');
    908:write('9333F');
    909:write('9486F');
    910:write('9126F');
    911:write('9081F');
    912:write('9477F');
    913:write('9198F');
    914:write('9468F');
    915:write('9504F');
    916:write('9603F');
    917:write('9360F');
    918:write('9396F');
    919:write('9477F');
    920:write('9423F');
    921:write('9522F');
    922:write('9450F');
    923:write('9702F');
    924:write('9432F');
    925:write('9594F');
    926:write('9558F');
    927:write('9630F');
    928:write('9549F');
    929:write('9477F');
    930:write('9675F');
    931:write('9549F');
    932:write('9702F');
    933:write('9540F');
    934:write('9738F');
    935:write('9666F');
    936:write('9729F');
    937:write('9801F');
    938:write('9657F');
    939:write('9810F');
    940:write('9729F');
    941:write('9513F');
    942:write('9612F');
    943:write('9774F');
    944:write('9684F');
    945:write('9702F');
    946:write('9675F');
    947:write('9504F');
    948:write('9792F');
    949:write('9684F');
    950:write('9639F');
    951:write('10035F');
    952:write('9855F');
    953:write('9774F');
    954:write('9783F');
    955:write('9990F');
    956:write('9999F');
    957:write('9954F');
    958:write('9945F');
    959:write('9981F');
    960:write('9954F');
    961:write('9999F');
    962:write('9900F');
    963:write('10071F');
    964:write('10125F');
    965:write('10080F');
    966:write('9828F');
    967:write('10116F');
    968:write('10143F');
    969:write('10089F');
    970:write('10134F');
    971:write('9711F');
    972:write('10053F');
    973:write('10314F');
    974:write('10035F');
    975:write('10278F');
    976:write('9990F');
    977:write('10053F');
    978:write('10179F');
    979:write('10413F');
    980:write('10134F');
    981:write('10341F');
    982:write('10458F');
    983:write('9990F');
    984:write('10296F');
    985:write('10053F');
    986:write('10296F');
    987:write('10206F');
    988:write('10287F');
    989:write('10332F');
    990:write('10467F');
    991:write('10287F');
    992:write('10296F');
    993:write('10251F');
    994:write('10584F');
    995:write('10395F');
    996:write('10233F');
    997:write('10368F');
    998:write('10287F');
    999:write('10539F');
    1000:write('10539F');
    end;
    end.

    • @ 2014-06-02 08:55:26

      牛!!

    • @ 2014-08-03 22:14:14

      +1

    • @ 2014-09-06 09:28:11

      +1

    • @ 2015-06-04 17:39:18

      厉害,佩服

    • @ 2015-10-06 15:04:09

      怎么做到的???????我一直不会,羡慕!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

  • 0
    @ 2013-11-08 09:19:01

    var
    a:array[0..10000] of longint;
    n,i,j,k,p,cnt,ans:longint;
    function ok(k:longint):boolean;
    var
    i:longint;
    begin
    if k<2 then exit(false);
    if k=2 then exit(true);
    for i:=2 to trunc(sqrt(k)) do
    if k mod i=0 then exit(false);
    exit(true);
    end;
    begin
    readln(n);
    p:=5;
    while n>=p do
    begin
    cnt:=cnt+n div p;
    p:=p*5;
    end;
    k:=1;
    a[k]:=1;
    for i:=2 to n do
    begin
    p:=i;
    while p mod 5=0 do
    p:=p div 5;
    while (p mod 2=0) and (cnt>0) do
    begin
    dec(cnt);
    p:=p div 2;
    end;
    for j:=1 to k do
    a[j]:=a[j]*p;
    for j:=1 to k do
    if a[j]>9 then
    begin
    a[j+1]:=a[j+1]+a[j] div 10;
    a[j]:=a[j] mod 10;
    end;
    while a[k+1]>0 do
    begin
    inc(k);
    a[k+1]:=a[k+1]+a[k] div 10;
    a[k]:=a[k] mod 10;
    end;
    end;
    for i:=1 to k do
    ans:=ans+a[i];
    write(ans);
    if ok(ans) then writeln('T') else writeln('F');
    end.

    水题不解释。
    这里提一个小小的优化。
    先统计1-n中5的个数。
    每次把相应的2减掉(因为2的个数比5 多)
    这样就能把末尾的0去掉。。

  • 0
    @ 2013-11-07 15:28:21

    评测结果
    编译成功

    测试数据 #0: Accepted, time = 0 ms, mem = 840 KiB, score = 25

    测试数据 #1: Accepted, time = 0 ms, mem = 844 KiB, score = 25

    测试数据 #2: Accepted, time = 0 ms, mem = 844 KiB, score = 25

    测试数据 #3: Accepted, time = 0 ms, mem = 840 KiB, score = 25

    Accepted, time = 0 ms, mem = 844 KiB, score = 100

    好水………………………………………………

    noip2013 rp++

  • 0
    @ 2013-10-29 12:59:17

    拿水题练下MillerRabbin

  • 0
    @ 2013-07-30 16:09:12

    刚好50遍

  • 0
    @ 2013-07-30 16:01:47

    当前正在显示题目为“P1200”的记录。显示所有记录
    Flag 得分 (ms) (MiB) 题目 递交者 语言 递交时间
    Accepted 100 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:59:15
    Wrong Answer 50 14 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:59:03
    Wrong Answer 75 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:58:44
    Wrong Answer 75 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:58:40
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:58:26
    Wrong Answer 0 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:58:24
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:58:11
    Wrong Answer 75 3 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:58:09
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:58:07
    Wrong Answer 75 7 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:57:58
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:57:57
    Wrong Answer 75 15 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:57:55
    Wrong Answer 25 15 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:57:46
    Wrong Answer 50 15 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:57:32
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:57:21
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:57:07
    Wrong Answer 75 15 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:56:50
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:56:47
    Wrong Answer 75 15 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:56:40
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:56:32
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:56:19
    Wrong Answer 50 7 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:56:06
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:55:54
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:55:35
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:55:26
    Wrong Answer 75 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:55:18
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:55:07
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:54:55
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:54:47
    Wrong Answer 0 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:54:32
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:54:23
    Wrong Answer 25 22 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:54:04
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:53:53
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:53:41
    Wrong Answer 75 15 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:53:26
    Wrong Answer 0 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:53:16
    Wrong Answer 50 15 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:53:07
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:52:50
    Wrong Answer 75 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:52:39
    Wrong Answer 25 15 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:52:27
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:52:18
    Wrong Answer 0 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:52:09
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:51:54
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:51:47
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:51:34
    Wrong Answer 75 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:51:13
    Wrong Answer 50 15 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:50:59
    Wrong Answer 75 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:50:49
    Wrong Answer 25 15 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:50:37
    Wrong Answer 0 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:50:22
    Wrong Answer 75 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:50:05
    Wrong Answer 25 30 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:49:57
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:49:45
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:49:30
    Wrong Answer 75 15 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:49:12
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:48:55
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:48:43
    Wrong Answer 50 3 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:48:16
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:48:01
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:47:35
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:47:16
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:46:58
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:46:41
    Wrong Answer 25 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:46:30
    Wrong Answer 50 0 0 P1200 ganggang的烦恼 1515440237 Pascal 2013-07-30 15:46:10
    苦尽甘来
    const max=10000;
    var i,j,p,n,k,x:integer;
    a:array[1..10000] of integer;
    begin
    readln(n);
    k:=max;
    a[k]:=1;
    for i:=2 to n do
    begin
    x:=0;
    for j:=max downto k do
    begin
    x:=x+a[j]*i;
    a[j]:=x mod 10;
    x:=x div 10;
    end;
    while x>0 do
    begin
    k:=k-1;
    a[k]:=x mod 10;
    x:=x div 10;
    end;
    end;
    p:=0;
    for i:=k to max do inc(p,a[i]);
    randomize;
    n:=random(100);
    if n<50 then writeln(p,'T')
    else writeln(p,'F');
    end.
    1/16 的可能

  • 0
    @ 2013-06-14 20:26:08

    一直担心会超时...结果好像不必担心...
    #include <iostream>
    #include <string>
    #include <math.h>

    using namespace std;

    const int MAX=3000;
    int ans[MAX]={0};

    int main(int argc, char *argv[])
    {
    int n,i,j,carry;
    cin>>n;
    ans[0]=1;
    for( i=2 ; i<=n ; ++i )
    {
    carry=0;
    for( j=0 ; j<=MAX ; ++j )
    {
    int val;
    val=ans[j]*i+carry;
    ans[j]=val%10;
    carry=val/10;
    }
    }
    int sum=0;
    for( i=0 ; i<=MAX ;++i )
    {
    sum+=ans[i];
    }
    cout<<sum;
    bool flag=1;
    for( i=2 ; i<=sqrt(sum) ; ++i )
    {
    if( sum%i==0 )
    {
    flag=0;
    break;
    }
    }
    if(flag)cout<<'T';
    else cout<<'F';
    //system("PAUSE");
    return EXIT_SUCCESS;
    }

  • 0
    @ 2013-03-23 20:04:37

    我又手贱了……
    高精度乘法,翻教科书就行了!
    质数判断只需从2循环到平方根,依次判断能否整除(我这个2B把2打成了1,错了两次)
    代码:
    program P1200;
    type
    numbertype=array[0..500] of integer;
    var
    n,i,j,k:integer;
    a:numbertype;
    d:string;
    procedure mul(b:integer; var a:numbertype); {高精度乘法}
    var
    i:integer;
    begin
    a[1]:=a[1]*b;
    for i:=2 to j do
    begin
    a[i]:=a[i]*b;
    a[i]:=a[i]+a[i-1] div 10;
    a[i-1]:=a[i-1] mod 10;
    end;
    while a[j]>=10 do
    begin
    inc(j);
    a[j]:=a[j-1] div 10;
    a[j-1]:=a[j-1] mod 10;
    end;
    end;
    begin
    readln(n); {读入}
    j:=1;
    a[1]:=1;
    for i:=1 to n do
    mul(i,a); {实现高精度}
    for i:=j downto 1 do
    k:=k+a[i]; {求各位数和}
    for i:=2 to trunc(sqrt(k)) do
    if k mod i=0 then begin writeln(k,'F'); halt; end; {判断质数}
    writeln(k,'T');
    end.

  • 0
    @ 2012-10-21 18:31:51

    编译通过...

    ├ 测试数据 01:答案正确... (0ms, 620KB)

    ├ 测试数据 02:答案正确... (0ms, 620KB)

    ├ 测试数据 03:答案正确... (0ms, 620KB)

    ├ 测试数据 04:答案正确... (0ms, 620KB)

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

    Accepted / 100 / 0ms / 620KB

    高精度阶乘+素数

    农夫山泉有点甜

  • 0
    @ 2012-07-18 17:00:07

    type

    KEY=array[0..10000] of longint;

    var

    a:KEY;

    l,i,s,n:longint;

    procedure MUL(var a:KEY; b:integer);

    var

    i:integer;

    begin

    a[1]:=a[1]*b;

    for i:=2 to l do

    begin

    a[i]:=a[i]*b+a div 10;

    a:=a mod 10;

    end;

    while a[l]>9 do

    begin

    inc(l);

    a[l]:=a[l-1] div 10 ;

    a[l-1]:=a[l-1] mod 10;

    end;

    end;

    function PRIME(n:longint):boolean;

    var

    i:longint;

    p:boolean;

    begin

    p:=true;

    if n

  • 0
    @ 2010-07-15 16:00:24

    连测试数据都很水

    不到100.。。

  • 0
    @ 2009-11-08 18:29:52

    #include

    #include

    using namespace std;

    int main(){

    int ans=0;

    int la=1;int a[2568];

    a[1]=1;

    int n,i,j,t=0;

    scanf("%d",&n);

    for(j=n;j>=1;j--){

    a[1]=a[1]*j;

    for(i=2;i=10){

    la++;

    a[la]=a[la-1]/10;

    a[la-1]=a[la-1]%10;}

    }

    for(i=la;i>=1;i--)ans+=a[i];

    printf("%d",ans);

    for(i=2;i

  • 0
    @ 2009-10-30 16:34:54

    big number....

  • 0
    @ 2009-10-22 13:23:01

    水题啊……

    就是数组的规模害惨了。

    ………………………………

  • 0
    @ 2009-10-12 21:45:03

    看到最短的程序

    怀念楼下学长xueyanbing,遂又做此水题,留念

    去年的此时……

  • 0
    @ 2009-10-03 14:09:20

    YEAH

    贴的是用Delphi写的

    program Project1;

    {$APPTYPE CONSOLE}

    uses

    SysUtils;

    var

    n,l,i,ans:longint ;

    a:array[0..10000] of longint ;

    function prime(x:longint):boolean ;

    var

    i:longint ;

    begin

    for i := 2 to trunc(sqrt(x)) do

    if x mod i = 0 then exit(false) ;

    exit(true) ;

    end ;

    procedure multiply(x:longint) ;

    var

    i:longint ;

    begin

    a[1] := a[1] * x ;

    for i := 2 to l do

    begin

    a[i] := a[i] * x ;

    a[i] := a[i] + a div 10 ;

    a := a mod 10 ;

    end ;

    while a[l] >= 10 do

    begin

    inc(l) ;

    a[l] := a[l-1] div 10 ;

    a[l-1] := a[l-1] mod 10 ;

    end ;

    end ;

    begin

    readln(n) ;

    fillchar(a,sizeof(a),0) ;

    a[1] := 1 ;

    l := 1 ;

    for i := 1 to n do

    multiply(i) ;

    ans := 0 ;

    for i := 1 to l do

    inc(ans,a[i]) ;

    write(ans) ;

    if prime(ans) then writeln('T') else writeln('F') ;

    end.

  • 0
    @ 2009-10-02 00:15:35

    高精度+打表=AC

  • 0
    @ 2009-09-27 10:22:57

    program p1200;

    type

    shuzu=array[0..10000] of longint;

    var

    a:shuzu;

    l,i,s,n:longint;

    procedure chen(var a:shuzu; b:integer);

    var

    i:integer;

    begin

    a[1]:=a[1]*b;

    for i:=2 to l do

    begin

    a[i]:=a[i]*b+a div 10;

    a:=a mod 10;

    end;

    while a[l]>9 do begin inc(l); a[l]:=a[l-1] div 10 ; a[l-1]:=a[l-1] mod 10; end;

    end;

    function isprime(n:longint):boolean;

    var

    i:longint; p:boolean;

    begin

    p:=true;

    if n

信息

ID
1200
难度
4
分类
数论 | 素数判定 点击显示
标签
(无)
递交数
3394
已通过
1349
通过率
40%
被复制
12
上传者