首页 > 其他分享 >Practice on Codeforces and Atcoder in August

Practice on Codeforces and Atcoder in August

时间:2023-08-05 15:46:32浏览次数:41  

相关文章

  • Educational Codeforces Round 151 (Rated for Div. 2) 题解
    A.ForbiddenInteger显然,当\(x\not=1\)时,直接输出\(n\)个\(1\)即可否则,如果\(n\)为奇数,那就输出\(\lfloor\frac{n}{2}\rfloor-1\)个\(2\)和\(3\);如果\(n\)为偶数,那就输出\(\frac{n}{2}\)个\(2\)(要看一下\(k\)的大小)B.ComeTogether因为Bob和Carol都......
  • Codeforces Round 882 (Div. 2)
    link题号:CF1847A~FA题意:给定一个数组\(\{x_1,x_2,\cdots,x_n\}\)和一个整数\(k\),记\(f(l,r)=\sum_{i=0}^{i<r-l}|x_{l+i}-x_{l+i+1}|\),求将数组划分为\(k\)个部分的划分方案,使得对每个部分的\(f(l,r)\)之和最小.题解:简单题,首先我们注意到,如果将\(l,l+1\)隔开,那......
  • Codeforces Round 424 (Div. 1)D. Singer House
    传送门显然要自底向上进行\(dp\)深度相同的子树结构相同所以可以利用深度来代表子树。那么就应该统计出有向路径的个数。考虑路径由链所拼成。那么状态里应该有有向链的条数。设\(f_{i,j}\)表示深度为\(i\)链条数为\(j\)的方案数。不选当前的节点则\(f_{i,j}=f_{i+1,k}\cdot......
  • Codeforces 1855B:Longest Divisors Interval 最长的连续约数区间
    1855B.LongestDivisorsIntervalDescription:对于一个整数\(n\)\((1\leqn\leq10^{18})\),找到一段最长的区间\([l,r]\),使得区间内所有数均为\(n\)的约数。Analysis:如果\(n\)是一个奇数(非\(2\)的倍数),由于\(odd=odd\timesodd\),则不可能有连续的两个整数均为......
  • Codeforces Round 449 (Div. 1) D. Nephren Runs a Cinema 卡特兰数
    luogu链接题意不再赘述。优先枚举的应该是\(VIP\)用户,枚举范围应该是\([0,n-l]\)之后总客户数为\(s=n-i\)再考虑枚举\(100\)的总人数为\(x\)则要求\(s-2x\in[l,r]\)这部分方案数应该为从\((0,0)\)到达\((s-x,x)\)且不越过\(y=x\)的方案数。利用折线法求出方案数为\(C(s,x)......
  • Toyota Programming Contest 2023#4(AtCoder Beginner Contest 311)
    Preface补下好久之前打的比赛博客这场前面都写的挺稳的,然后一到G就降智了没写出来A-FirstABC签到#include<cstdio>#include<iostream>#include<utility>#include<vector>#include<cstring>#include<cmath>#include<algorithm>#include<queue>#i......
  • Educational Codeforces Round 38 C- F
    EducationalCodeforcesRound38C-Fhttps://codeforces.com/contest/938今天写出了三题ovoC.ConstructingTests多画几个图就能发现,对于\(n\timesn\)的正方形来说,要使得\(m\timesm\)的子正方形至少有一个\(0\),则最少的\(0\)个数为\(\lfloor\frac{n}{m}\rfloo......
  • PTE RS practice
    Shehasasmallbusinesssellingtoystobigmanufacturesathome.Studentsmustattendthesafetycoursebeforeenteringtheengineeringworkshop.Theassessmentofthiscoursewillbeginnextweek.Wearecommittedtorecruitingthebeststudentsregar......
  • nfls15095 Atcoder-abc123_d 蛋糕
    Atcoder-abc123_dAT小卖部从下学期开始售卖带有数字形状的蛋糕,\(X\),\(Y\)和\(Z\)种蛋糕分别带有\(1\)形,\(2\)形和\(3\)形蜡烛,而且每个蛋糕都有美味值,如下所示:带有\(1\)形蜡烛的美味值有:\(A_1,A_2,\cdots,A_X\)带有\(2\)形蜡烛的美味值有:\(B_1,B_2,\cdots,B_Y\)......
  • Educational Codeforces Round 104
    https://codeforces.com/contest/1487A.Arena统计与最小值不同的数字数量。#include<bits/stdc++.h>usingnamespacestd;#defineintlonglongconstintM=(1<<15)-1;voidsolve(){intn;cin>>n;vector<int>a(n);for(......