思路:预处理出右边第一个比
原创 1天前
21阅读
题意:输出2到n在一颗不平衡二叉排序树里面的父
原创 1天前
0阅读
codeforces 675D Tree Construction(set)
思路:一个很经典的题目,求补图的最短路,方法是建原图,然后用两个set
原创 1天前
19阅读
思路:列一下方程就可以知道只要固定一个数,那么剩下的三 if (a>=1 && a=1&&b=1 &&c<=n)
原创 1天前
0阅读
codeforces 675B Restoring Painting
题意:给定n个点,问选4个点能组成凸四边形的个数思路:凸包模板上#include <cstdio> #include <queue> #include <cstring> #include <iostream> #include <cstdlib> #include <algorithm> #include <vecto
原创 1天前
21阅读
题意:n个地铁站,m条线路,地铁站之间花费t时间,不属于同一条线路的地铁站需要“转站”,即加上一个额外花费w(w为线路代号的差值)。 求1到n的最短时间思路:由于有转站的影响,可以考虑将地铁站拆点,权值是他们的差值,或者直接以边作为点也是可以的#includ
原创 1天前
12阅读
思路:状态dp[i][k]表示第i个位置放编号为k的物品,则dp[i][k]= int T;
原创 1天前
0阅读
思路:这个题目题意坑的不行。。最后强
原创 1天前
22阅读
思路:想法题,前缀和出现次数最多的值就是 区间和
原创 1天前
18阅读
思路:对于某一颗子树来说,只需要统计这颗子树拥
原创 1天前
17阅读
思路:水题 double a[10000]; double b[10000]; int ti[10000]; double dis(int i,int j) { return sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(
原创 1天前
0阅读
思路:一棵树有2(n-1)个度,每个度都有它的权值
原创 1天前
16阅读
HDU 5534 Partial Tree(背包)
思路:把恶心的题目看完...然后就是floyd裸题了#include <iostream> #include <cstring> #include <cstdio> #define inf 0x3f3f3f3f using namespace std; int mmap[100][100],n; void floyd() { for(int k=1; k&l
原创 1天前
25阅读
UVa567 Risk(floyd)
题意:时候,左括号的栈是否为空#includeusing namespace std;str
原创 1天前
36阅读
思路:直接n^3显然会超时的,那么我们做一个小小的优化就是先判断两个人是否互
原创 1天前
41阅读
思路:利用容斥原理,首先考虑总的情况,即求x+y+z是组合数C(i+2,2),因为
原创 1天前
35阅读
题意:你有n个非0就是1的数字,你可以修改最多k个,使得0变成1,然后问你修改之后,最长的连续1的串是多长?思路:维护一个前缀0的个数,然后对于每个位置,直接暴力二分就好了,二分这个位置最远能够延展到哪儿 #include<bits/stdc++.h> using namespace std; const int maxn = 1e6; int n,k; int a[maxn
原创 1天前
33阅读
思路:水题#includeusing namespace std;int main(){ int n,x; cin >> n >>x; int a
原创 1天前
35阅读
Codeforces Round #319 (Div. 2)A Multiplication Table
思路:阅读题....读懂题目之后就是结构体排个序#includeusing namespace std;struc
原创 1天前
35阅读
这样。问你这些人走的样子是什么样子思路:先走的奇数,然后再走偶数位置,先走大于2n的,再走小于的。#includeusing namespac
原创 1天前
0阅读
思路:水题,直接全部加起来,并且维护一个最小的奇数,因为如果最后结果是奇数
原创 1天前
21阅读
思路:树链剖分的模板#include #include #include #include using namespace std;#defin
原创 1天前
19阅读
前言我们在工作中,会遇到需要使用不同的硬件设备测试兼容性的问题,尤其是现在手机型号,屏幕大小分辨率五花八门的,我们基本不可能全部机型都用真机测试一遍,playwright提供了模仿机型的功能,我们可以使用playwright来模拟设备。设置手机模式配置需要模拟的设备,我们需要配置我们使用的设备,Playwright 就会模拟浏览器行为,例如"userAgent"、"screenSize"以及"vi
思路:一道比较简单的概率DP,转移方程见代码#include#include#includeusing n
原创 1天前
24阅读
思路:水题#include #include #include #include #include #include #include #include.txt","r"
原创 1天前
16阅读
思路:哈希之后一直爬就是了#include #include #include #include #include #i
原创 1天前
23阅读
题意:
原创 1天前
20阅读
思路:一个很经典的博弈问题,转自大神的题解首先总人数是n+1人。由于必须半数
原创 1天前
0阅读
思路:将Alice的期望写出来化简之后有E(x)=(pa*(a+b+2c)-b-c)pb-b*pa-c*pa+b 因为Alice与B是否出杀无关,即第一项pb那里的系数为0,所以可以推导出pa*(a+b+2c)-b-c=0,pa为Alice出杀的概率,解出来代会原式即可#includeusing namespace st
原创 1天前
18阅读
思路:树链剖分的裸题了#include#include#include#include#define LL lon
原创 1天前
14阅读