当前位置: 代码迷 >> 综合
 解决方案列表
  • [综合] Diverse Team CodeForces - 988A

    Thereare nstudentsinaschoolclass,theratingofthe i-thstudentonCodehorsesis ai.Youhavetoformateamconsistingof kstudents( 1≤k≤n )suchthattheratingsofallt...

    22
    热度
  • [综合] Binary String Constructing CodeForces - 1003B

    Youaregiventhreeintegersaa,bbandxx.Yourtaskistoconstructabinarystringssoflengthn=a+bn=a+bsuchthatthereareexactlyaazeroes,exactlybbonesandexactlyxxindi...

    55
    热度
  • [综合] 区间重叠问题 Size Balanced Tree Gym - 101755C

    Pavelisdevelopingagame.Todothat,heneedsfunctionsavailableinathird-partylibrarytoofamoustobecalled.Itisknownthatthefunctionifirstappearedinversionaiand...

    45
    热度
  • [综合] 最短路 dijkstra算法模板

    计算单源最短路不能计算负环 邻接矩阵 #include<iostream> #include<algorithm> #include<cstdio> #include<cstdlib> #include<cstring> usingname...

    3
    热度
  • [综合] 最短路 floyd模板

    多源最短路简单但复杂度高 #include<iostream> #include<algorithm> #include<cstdio> #include<cstdlib> #include<queue> #include<cstri...

    29
    热度
  • [综合] 最短路 bellman模板

    intu[MAX,v[MAX],w[MAX]; intdist[MAX]; intn,m; voidbellman(intvs) {inti,j,k;for(i=1;i<=n;i++)dist[i]=inf;dist[vs]=0;for(k=1;k<=n-1;k++)//最多需要松弛n-...

    22
    热度
  • [综合] The Debut Album URAL - 2018

    Pop-group“Pinkelephant”enteredonrecordingtheirdebutalbum.Infacttheyhaveonlytwosongs:“Mylove”and“Imissyou”,buteachofthemhasalargenumberofremixes. Thepr...

    26
    热度
  • [综合] Adventure Time URAL - 2024

    ‘Here’sforyou!’shoutedFinnfightingtheShadowGuardians.‘Jake!CollecttheDarknessRocksandlet’srunfromhere!’ Jakewouldhavebeengladtofinishassoonaspossible,...

    30
    热度
  • [综合] Architect of Your Own Fortune

    J.ArchitectofYourOwnFortune Vasyaisaschoolboywhoridesatrolleybusandthenabustogettoschool.He’salwaysveryhappytogeta“luckyticket,”whichmeansthetotalofth...

    73
    热度
  • [综合] 染色模板

    #include<queue> #include<cstring> #include<iostream> usingnamespacestd;constintN=999; intcol[N],Map[N][N];//0为白色,1为黑色 boolBFS(ints,i...

    50
    热度
  • [综合] 钥匙计数之二 HDU - 1480

    一把钥匙有N个槽,2<N<26槽深为1,2,3,4,5,6。每钥匙至少有3个不同的深度且相连的槽其深度之差不得为5。求这样的钥匙的总数。 Input 本题无输入 Output 对2<N<26,输出满足要求的钥匙的总数。 SampleOutput N=3:104 N=4:904...

    95
    热度
  • [综合] Eddy's爱好 HDU - 2204 容斥

    Ignatius喜欢收集蝴蝶标本和邮票,但是Eddy的爱好很特别,他对数字比较感兴趣,他曾经一度沉迷于素数,而现在他对于一些新的特殊数比较有兴趣。这些特殊数是这样的:这些数都能表示成M^K,M和K是正整数且K>1。正当他再度沉迷的时候,他发现不知道什么时候才能知道这样的数字的数量,因此他又求助...

    2
    热度
  • [综合] 容斥模板

    //判断1-n有多少个M个因子任一个的倍数 intn,m,cnt; llans,a[30]; llgcd(lla,llb) {returnb==0?a:gcd(b,a%b); }voidDFS(intcur,lllcm,intid) {//当前第几个因子这些因子的最小共公倍数当前总因子lcm=a[c...

    80
    热度
  • [综合] Squirrel and chestnut CodeChef - SQUIRREL

    Therearensquirrel(s)waitingbelowthefeetofmchestnuttree(s).Thefirstchestnutofthei-thtreewillfallrightafterTisecond(s),andonemoreeveryPisecond(s)afterth...

    95
    热度
  • [综合] 二分法 模板

    while(l+1<r){mid=(l+r)>>1;if(ok(m))l=m;elser=m;}if(ok(r))printf("%d\n",r);elseprintf("%d\n",l); 二分查找(百度百科) #include<iostream> #defineN1...

    80
    热度
  • [综合] 除法分块求区间约数和

    LLget_sum(LLn){LLans=0;for(LLl=1,r;l<=n;l=r+1){r=n/(n/l);ans+=(n/l)*(l+r)*(r-l+1)/2;}returnans;}

    23
    热度
  • [综合] 第三届大中学生社团ACM程序设计大赛题解

    AAlice和Bob 题意:两人取一堆石子石子有n个先手第一次不能全部取完但是至少取一个之后每人取的个数不能超过另一个人上一次取的数的K倍拿到最后一颗石子的赢先手是否有必胜策略若有先手第一步最少取几个思路:(1)首先k=1的时候必败态是2^i因为把数二进制分解后拿掉二进制的最后一个1,那么对方必然不...

    87
    热度
  • [综合] 结构体重载运算符

    structnode{inta,b;node&operator+(node&xx){a+=xx.a;b+=xx.b;} }; structnode{inta,b;booloperator<(constnode&xx)const{if(a==xx.a){returnb&l...

    10
    热度
  • [综合] 齿轮 HYSBZ - 4602

    现有一个传动系统,包含了N个组合齿轮和M个链条。每一个链条连接了两个组合齿轮u和v,并提供了一个传动比x :y。即如果只考虑这两个组合齿轮,编号为u的齿轮转动x圈,编号为v的齿轮会转动y圈。传动比为正表示若编号 为u的齿轮顺时针转动,则编号为v的齿轮也顺时针转动。传动比为负表示若编号为u的齿轮顺时针...

    18
    热度
  • [综合] BerOS File Suggestion CodeForces - 1070H

    PolycarpisworkingonanewoperatingsystemcalledBerOS.Heasksyoutohelpwithimplementationofafilesuggestionfeature. Therearennfilesonharddriveandtheirnamesar...

    28
    热度