problem binary quasi 538
AGC041D-Problem Scores 题解
题目链接 luogu atcoder 分析 令 \(k=\left \lfloor \frac{n}{2} \right \rfloor\) 对于第三个条件,只需要满足 \(\sum_{i=1}^{k+1}a[i]<\sum_{i=n-k+1}^{n}a[i]\) 即可 有一个 \(trick\): ......
[题解] CF1748E Yet Another Array Counting Problem
Yet Another Array Counting Problem 给你一个长度为 \(n\) 的序列和一个数 \(m\),求有多少个长度为 \(n\) 的序列 \(b\) 满足: \(\forall i \in [1, n], b_i \in [1, m]\)。 对于每个区间 \([l, r]\ ......
高精A+B Problem
#include <iostream> #include <cstdio> using namespace std; int c[100000]; int d[100000]; int e[100000]; int main() { string a, b; cin >> a >> b; if (a ......
P2639 [USACO09OCT] Bessie's Weight Problem G
大概就是在不超过容量的情况下,问你最多能吃多少 是吃与不吃,选与不选的问题,所以是01背包,但是是变式 #include<bits/stdc++.h> using namespace std; const int N=5e4; int f[N],t[1000]; int main(){ int T, ......
导出相关binary制作k8s本地包
这次把我之前安装的k8s的包导出来保存。 cd /var/cache/apt/ ls kube* cd ~ && mkdir k8sdbinstall sudo cp *_1.23.17* ~/k8sdbinstall ......
Kattis - A Complex Problem (The 2023 ICPC Rocky Mountain Regional Contest)
Intro This was one of the problems I didn't do during the regional contest. One of my teammates solved it. Observation There are few things to note. F ......
CF803G Periodic RMQ Problem
题目描述 给你一个序列\(a\) 让你支持 \(1\) \(l\) \(r\) \(x\) 区间赋值 \(2\) \(l\) \(r\) 询问区间最小值 我们觉得这个问题太水了,所以我们不会给你序列\(a\) 而是给你序列一个长度为\(n\) 的序列\(b\) ,把\(b\) 复制粘贴\(k\) 次 ......
The use of green energy can effectively solve the problem of air pollution
The use of green energy can effectively solve the problem of air pollution 一、the operation of green energy Green energy refers to a way of producing a ......
D - Good Tuple Problem atcoder abc 327
D - Good Tuple Problem https://atcoder.jp/contests/abc327/tasks/abc327_d 思路 https://www.zhihu.com/question/292465499 判断二分图 的常见方法是染色法:用两种颜色,对所有顶点逐个染色,且 ......
Problem Description
Problem Description 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。 你的任务是,对于给定的N,求出有多少种合法的放置方法。 Input 共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量 ......
树状数组(Binary Index Tree)
一、问题引入 Logu P3374 模版题--树状数组。 初始化一个数组,接下来进行若干次以下操作: 单点修改:将某个元素的值进行修改 区间访问:返回该区间的总和 问题分析 如果通过简单索引操作,“1”的时间复杂度为 O(1),“2”的时间复杂度为O(n),其中如果使用一个dp表的方式来存储前n项之 ......
How To Solve The Problem Of Air Pollution
How To Solve The Problem Of Air PollutionThe report "China's Carbon Neutrality and Clean Air Synergy Pathway (2023)" was published in Beijing on Novem ......
PAT 1099 Build A Binary Search Tree
1099 Build A Binary Search Tree 30分 题目描述:告诉了BST的结点下标关系、结点值,求BST的层次遍历序列。 vector<int> in; // 保存中序序列 int Tree[105][2]; // 保存结点与左右孩子结点之间的下标 map<int,vector ......
[LeetCode] 2609. Find the Longest Balanced Substring of a Binary String
You are given a binary string s consisting only of zeroes and ones. A substring of s is considered balanced if all zeroes are before ones and the numb ......
PSO Solve N-Queen Problem
title: PSO Solve N-Queen Problem layout: page categories: data analysis PSO Solve 16-Queen Problem The N-Queens problem is a classic problem in the fi ......
CF1325E Ehab's REAL Number Theory Problem
题目传送门 题目大意 给定 \(n\) 个数,每个数的因数个数不超过 \(7\),求最少选出多少个数能使得乘积为一个完全平方数。 无解输出 \(-1\)。 思路 约数个数定理:对于 \[n=\prod^{k}_{i=1}p_i^{a_i} \]\(n\) 的正约数个数为 \(\prod^{k}\li ......
SEERC 2020 Problem H
题目链接 模拟赛搬了这题,场切了顺手写个题解。 这种题当然先考虑单组询问怎么做,然后再拓展出去。 设按位与的集合是 \(A\),按位或的集合是 \(B\),结果都是 \(x\),我们考虑 \(A,B\) 的元素应该满足的性质。不难发现,所有 \(y<x\) 的 \(y\) 都应该在 \(B\),\( ......
[ABC327G] Many Good Tuple Problems 题解
题意 对于一对长度均为 \(M\) 且元素值在 \(\left[1, N\right]\) 之间的序列 \((S, T)\),定义其为好的当且仅当: 存在一个长度为 \(N\) 的 \(01\) 序列 \(X\),使得其满足如下条件: 对于任意 \(i \in \left[1, M\right]\) ......
Binary Tree Level Order Traversal
Source Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). Example Given binary tree ......
NEFU OJ Problem1356 帽儿山奇怪的棋盘 题解
帽儿山奇怪的棋盘 题目: Time Limit:1000ms Memory Limit:65535K Description 军哥来到了帽儿山,发现有两位神人在顶上对弈。棋盘长成下图的模样: 每个点都有一个编号:由上到下,由左到右,依次编号为 1、2……12。两位神人轮流博 弈,每一轮操作的一方可以 ......
代码随想训练营第二十三天(Python)| 669. 修剪二叉搜索树 、108.将有序数组转换为二叉搜索树、538.把二叉搜索树转换为累加树
669. 修剪二叉搜索树 树的修剪方式赋值。 1、递归法 class Solution: def trimBST(self, root: Optional[TreeNode], low: int, high: int) -> Optional[TreeNode]: if root is None: ......
environmental problem--deforestation
Deforestation is a serious environmental issue in China and many other countries. The main reasons for deforestation are economic development needs, u ......
Trailhead - 证书维护挑战失败 提示Whoops, looks like there was a problem. Please try again.
前情提要 当进行Trailhead证书维护的时候,往往会需要完成答题+挑战(Challenge)。然而有时候会遇到下述的问题👉代码正确(至少看起来)并且在页面验证通过,在Challenge里Check时却提示”Whoops, looks like there was a problem. Plea ......
China's Air Pollution Problem
China's Air Pollution Problem Air pollution is a global problem, but China is particularly serious about it. In recent years, China's air quality inde ......
Solution to OpenSSL Connection Problems With Github
Problems Uploading Files with Git Sometimes we can use git tool to successfully upload projects to Github, but in other time especially after a period ......
数据结构与算法 | 二分搜索(Binary Search)
文承上篇,搜索算法中除了深度优先搜索(DFS)和广度优先搜索(BFS),二分搜索(Binary Search)也是最基础搜索算法之一。二分搜索也被称为折半搜索(Half-interval Search)也有说法为对数搜索算法(Logarithmic Search),用于在已排序的数据集中查找特定元素... ......
PAT甲级:1174 Left-View of Binary Tree
题目:1174 Left-View of Binary Tree 25分 题解:层次遍历输出每一行最左边的元素。(最开始以为输出部分节点的左子树...想不到思路) using namespace std; #include <iostream> #include <vector> #include ......
https://www.luogu.com.cn/problem/P1104 生日问题笔记
标记:当出现一组数据中有多个数据,这个时候我们常考虑用结构体去编写代码,因为结构体可以使得 几个本不相关的变量联系起来,并且当一个变量改变时,其他变量也会跟着改变,这使得代码变得简单。 使用结构体后,我们在读入数据之后,我们用sort 进行排序,并且构造一个cmp函数,使得我们的排序 满足题目的要求 ......
Urbanization Problem in CHINA
Urbanization Rapid urbanization has taken place in China ever since the economic development and socioeconomic changes of the 1980s. Approximately 40% ......