problem tricky sum

linux 中 md5sum -c 命令

001\ [root@pc1 test01]# ls [root@pc1 test01]# seq 3 > a.txt ## 测试文件 [root@pc1 test01]# ls a.txt [root@pc1 test01]# cat a.txt 1 2 3 [root@pc1 test01]# ......
命令 md5sum linux 5sum md5

【转载】How to solve the problem that getting timestamp from Mysql database is 8 hours earlier than the normal time

This article introduces the relevant knowledge of "how to solve the problem of obtaining timestamp from Mysql database 8 hours earlier than the normal ......
the timestamp database problem getting

Gym101064L The Knapsack problem

CF 传送门 发现物品的体积很小,尝试从此处入手。 设 \(K\) 为最大的物品体积。把背包体积 \(m\) 分成差不超过 \(K\) 的两部分,然后合并。这样需要求出 \(f(\frac{m}{2} - K \sim \frac{m}{2} + K)\)。 递归地,可以发现需要求出 \(f(\fr ......
Knapsack 101064L problem 101064 Gym

CF1870E Another MEX Problem 题解

原题 翻译 首先 \(O(n^3)\) 的 dp 是 simple 的。设 \(dp_{i,j}\) 表示前 \(i\) 个划分后异或和为 \(j\) 是否可行。因为转移不具有连续性,故bitset无法优化(其实 \(O(\frac{n^3}{\omega})\) 也跑不过去) 官方做法: 定义对于 ......
题解 Another Problem 1870E 1870

Count of Sub-Multisets With Bounded Sum

Count of Sub-Multisets With Bounded Sum You are given a 0-indexed array nums of non-negative integers, and two integers l and r. Return the count of s ......
Sub-Multisets Multisets Bounded Count With

CF1628D2 Game on Sum

题目链接(Easy) 题目链接(Hard) Part1 神奇的博弈类型 \(Dp\) 。 我们发现与当前状态有关的量,有且只有 现在是第几轮,还有 Bob 用了几次加的操作 ,这都会影响之后的决策,而和之前的决策无关,换句话说,当前决策有后效性,没有前效性。那我们考虑倒着 \(Dp\). Part2 ......
1628D 1628 Game Sum CF

[LeetCode] 1354. Construct Target Array With Multiple Sums 多次求和构造目标数组

You are given an array target of n integers. From a starting array arr consisting of n 1's, you may perform the following procedure : let x be the sum ......
数组 Construct LeetCode Multiple 目标

洛谷P1001 Problem A+B(Python)

关键在洛谷的数据输入的时候是在同一行输入的,如果写两个input(),就是在两行输入。 这里就要用到一个分割字符串的函数split()。其中,括号内字符为分割该字符串的分隔符。 代码如下(不放也行吧) a,b=input().split() print(int(a)+int(b)) ......
Problem Python P1001 1001

GDCPC2023 L Classic Problem

洛谷传送门 CF 传送门 对于一个点 \(x\),若 \(\exists i, u_i = x \lor v_i = x\),则称 \(x\) 为特殊点,否则为一般点。 首先发现,对于极长的一段 \([l, r]\) 满足 \(l \sim r\) 均为一般点,那么可以连边 \((l, l + 1) ......
Classic Problem GDCPC 2023

Codeforces Round 684 (Div. 2) B. Sum of Medians

定义 \(median\) 是一个非降序数组中第 \(\lceil \frac{n}{2} \rceil\) 的数。数组从 \(1\) 开始标号。 给两个数 \(n\) 和 \(k\) ,并给出一个长为 \(nk\) 的数组 \(a\) 。 需要分出为 \(k\) 个大小为 \(n\) 的数组,每个 ......
Codeforces Medians Round 684 Div

解决SUM函数返回为NULL

解决SUM函数返回为NULL SUM函数的作用:计算某一字段中所有行的数值和, 使用SUM函数进行对符合条件的结果行数进行求和。 问题产生: sum 求和时会对 null 进行过滤,不计算,但如果没有返回结果,则sum 函数的返回值为 null,不是 0: 解决方式: 1. IFNULL 使用IFN ......
函数 NULL SUM

CF1886A Sum of Three 题解

Question 给定一个正整数 N ,我们需要找三个不同的整数x,y,z,使得 N = x+y+z,其中下x,y,z不能被三整除 solution 我们把N%3会有一些余数,我们针对余数来讨论,其中我们只关注xyz的余数 如果余数为0 那么也就可能是1+1+1,或者2+2+2,但是考虑到xyz不同 ......
题解 1886A Three 1886 Sum

为什么我们需要不断的开发不同的机器学习模型 —— Do we Need Hundreds of Classifiers to Solve Real World Classification Problems?

论文: 《Do we Need Hundreds of Classifiers to Solve Real World Classification Problems?》 论文地址: https://jmlr.org/papers/volume15/delgado14a/delgado14a.pdf ......

Codeforces Round 891 (Div. 3) F. Sum and Product(数论+map)

Codeforces Round 891 (Div. 3) F. Sum and Product 思路:对于x,y:ai+aj=x —> aj=x-ai 因此 ai*(x-ai) = y ——> ai = (x 土 sqr( x^2 - 4y ) ) /2 对应的 ai 就是要的两个值 若两个值不同 ......
数论 Codeforces Product Round 891

题解 CF457F 【An easy problem about trees】

尝试理解,感谢 cz_xuyixuan 的题解。 算作是很多情况的补充说明。 我们不妨先二分答案,将 \(\ge mid\) 的设为 \(1\),\(<mid\) 的设为 \(0\),于是问题转化为了权值均为 \(0/1\) 的版本。 我们称一棵树的大小为其非叶节点数。 我们称一棵大小为奇数的树为奇 ......
题解 problem about trees 457F

2023-02-06Fix dual system time problem copy

+++ title = "Fix dual system time problem" description = "" date = 2023-02-06T14:21:50+08:00 featured = false comment = true toc = true reward = true ......
problem system 2023 dual copy

D. Sum of XOR Functions

D. Sum of XOR Functions You are given an array $a$ of length $n$ consisting of non-negative integers. You have to calculate the value of $\sum_{l=1}^{ ......
Functions Sum XOR of

[LeetCode] 2578. Split With Minimum Sum

Given a positive integer num, split it into two non-negative integers num1 and num2 such that: The concatenation of num1 and num2 is a permutation of  ......
LeetCode Minimum Split 2578 With

题解 AGC015D【A or...or B Problem】

题解 AGC015D【A or...or B Problem】 problem 从 \(\ge A\) 且 \(\le B\) 的整数中选择一个或多个,把这些整数按位或,求一共有多少种可能的结果。 \(1\le A\le B \le 2^{60}\) solution 首先暴力怎么写呢?FWT。设序 ......
题解 Problem 015D or AGC

CF1857F Sum and Product

根据题意我们有:\(b=a_i+a_j\),\(c=a_i\times a_j\)。 可以发现 \(a_i\) 和 \(a_j\) 是一元二次方程 \(x^2-bx+c=0\) 的根。 那么就可以根据求根公式 \(x=\dfrac{-b\pm \sqrt{b^2-4ac}}{2a}\) 来求出 \( ......
Product 1857F 1857 Sum and

NC17383 A Simple Problem with Integers

来记录一下实现方式,真的有点妙。 首先通过打表可以发现进入循环节前的长度最多为 \(4\),最小循环节的长度只有 \(1,2,3,6\)。 所以我们可以记录当前平方了几次,到达 \(4\) 次后算出长度为 \(6\) 的循环节中的数,之后只要记录平方次数模 \(6\) 后的值即可。 放一下 \(O( ......
Integers Problem Simple 17383 with

QT在debug环境下的异常报错 This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

查看错误信息:试试Release 检查 控制台 (/SUBSYSTEM:CONSOLE) 输入错误信息,修改全部报错信息后再试试Debug模式可不可以运行。 方案一:高级系统设置-环境变量- QT_QPA_PLATFORM_PLUGIN_PATH C:\Qt\Qt5.12.12\5.12.12\ms ......

【分治】CF429D Tricky Function 题解

CF429D 令 \(sum_i\) 表示 \(\sum \limits_{j=1}^{i} {a_j}\)。 则 \(g(i, j) = (sum_j - sum_i)\)。 \(f(i, j) = (i - j)^2 + g(i, j)^2 = (i - j) ^ 2 + (sum_i - su ......
题解 Function Tricky 429D 429

D. Prefix Permutation Sums

D. Prefix Permutation Sums 吐槽:读题不仔细,还以为原数组的取值是任意的,最后看题解的时候才发现取值在[1,n],当时因为看不懂直接跳过了 题意:给你一个缺了一个的前缀和数组,让你判断是否存在原数组,取值[1,n],每个数只存在一次 可以分类讨论 1 缺少最后一个前缀和 2 ......
Permutation Prefix Sums

My Public Problems Setting Collection

Coming Soon! Here list some of the public problems set by me. Format: # ID / When / Problem Name / Where / Link / Difficulty / Comment XX 2014 / XXX / ......
Collection Problems Setting Public My

【思维】【DP】ABC298Ex Sum of Min of Length 题解

ABC298Ex 简单题。 因为有 \(\min\) 不好做,容易想到讨论 \(d(i, L)\) 和 \(d(i, R)\) 的大小。 令 \(p = \text{LCA}(L, R)\),\(dep_L > dep_R, dist = dep_L + dep_R - 2\times dep_p\ ......
题解 思维 Length of ABC

【竞赛图】【DP】ARC163D Sum of SCC 题解

ARC163D 发现这个竞赛图一定能被分为两个集合 \(A\),\(B\)。满足 \(\forall u\in A,v\in B\),均有 \(u\to v\in E\)。答案就是划分这两个集合的方案数。 证明: 首先,竞赛图缩完点后一定是一条链,对强连通分量进行标号,满足编号小的强连通分量指向编号 ......
题解 163D ARC 163 Sum

The 2023 ICPC Asia EC Regionals Online Contest (I) - Problem C. Multiply Then Plus

离线询问,建立时间线段树,那么每条直线存在的时间是一个区间,对应时间线段树上$\mathcal{O}(\log n)$个节点,每个询问对应时间线段树上某个叶子到根的$\mathcal{O}(\log n)$ 个节点。 对于时间线段树中的某个节点,它代表的直线集合是静态的,问题转化为静态区间查询。对于 ......
Regionals Multiply Contest Problem Online

The 2023 ICPC Asia EC Regionals Online Contest (I) - Problem H. Range Periodicity Query

对于一个周期长度$p$来说,如果它不是$S_k$的周期,那么它一定不是$S_{k+1}$的周期,因此可以二分出分界线$t_p$满足它是$S_p,S_{p+1},S_{p+2},\dots,S_{t_p}$的周期,但不是$S_{t_p+1}$的周期。对于一个询问$(k,l,r)$,问题等价于寻找区间中 ......
Periodicity Regionals Contest Problem Online

题解 P9701【[GDCPC2023] Classic Problem】

题如其名,确实挺经典的。 我们称边权在输入中给定的边为特殊边,其它边为平凡边。称特殊边涉及到的点为特殊点,其它点为平凡点。 显然,对于连续的若干平凡点 \([l,r]\),他们内部的最优连边方式就是连成一条链,花费 \(r-l\) 的代价。我们先把这样的代价加到答案中,然后将极长连续平凡点缩成一个点 ......
题解 Classic Problem P9701 GDCPC