Numbers

杭电多校赛第8场 1010 Rikka with Square Numbers

**题意** 给两个数字a,b 每次操作可以给a加上或者减去一个平方数,问需要最少几次操作使a变成b $1 #include using namespace std; int main() { ios::sync_with_stdio(false); int T , a , b , c , t , ......
Numbers Square Rikka 1010 with

Compatible Numbers

# Compatible Numbers ## 思路 对于一个数 $x$,如果想要构造一个数 $y$ 使得 $x \& y = 0$ 那么显然对于 $x$ 的每一位: 1. 如果当前位是 0,那么 $y$ 这一位可以填 $1,0$ 2. 如果当前位是 1,那么 $y$ 这一位可以填 $0$ 那么对于 ......
Compatible Numbers

[LeetCode] 1351. Count Negative Numbers in a Sorted Matrix 统计有序矩阵中的负数

Given a `m x n` matrix `grid` which is sorted in non-increasing order both row-wise and column-wise, return *the number of **negative** numbers in* `g ......
负数 矩阵 LeetCode Negative Numbers

CF449D Jzzhu and Numbers

有一个很蠢但是很好写的做法。 就是你先令 $t_i$ 为与起来恰好为 $i$ 的方案数,然后 $g_i$ 为与起来子集中有 $i$ 的方案数。 然后 $g_S=\sum\limits_{T\subseteq S}t_T$,反演一下变成 $t_{S}=\sum\limits_{T\subseteq S ......
Numbers Jzzhu 449D 449 and

CF1808C Unlucky Numbers 题解

可以证明答案是 $l$ 或 $r$ 的一段前缀,拼上后面全部相同的一段字符 $d$,证明方式类似数位 dp。能够自由填的数字一定是相等的,这样不会影响幸运值。前面那些不能自由填写的,就是 $l$ 或 $r$ 的一段前缀。假如不是 $l$ 或 $r$ 的一段前缀,必然填写相等的更好,而这种情况已经被考 ......
题解 Unlucky Numbers 1808C 1808

题解 CF1842H【Tenzing and Random Real Numbers】

看了题解。好难受,想用积分求概率,算了半天。发现没啥规律,不是不能算,就是太可怕了。 ## Problem 有 $n$ 个 $[0,1]$ 范围内的均匀随机变量 $x_{1\cdots n}$ 和 $m$ 条限制,每条限制形如 $x_i+x_j\le 1$ 或 $x_i+x_j\ge 1$。请你求出 ......
题解 Tenzing Numbers Random 1842H

PROPERTIES OF SQUARE NUMBERS

When a number is multiplied by itself, the resulting number is called as a square number. For example, when we multiply 5 by 5, we get 52 = 25. Here, ......
PROPERTIES NUMBERS SQUARE OF

Powerful-Numbers

title: Powerful Numbers feature: false mathjax: true date: 2022-09-08 09:04:35 tags: - 数论 categories: Math cover: https://pic.imgdb.cn/item/6319538116 ......
Powerful-Numbers Powerful Numbers

斯特林数 STIRLING NUMBERS

## 第二类斯特林数 定义:符号 $\begin{Bmatrix}n\\ k\end{Bmatrix}$ 表示有 $n$ 件物品的集合划分成 $k$ 个非空子集的方案数。例如,将有一个有 $4$ 个元素的集合分成两部分有 $7$ 种方法: $$\rm \{1,2,3\}∪\{4\}, \ \{1,2 ......
STIRLING NUMBERS

每日一题 力扣 445 https://leetcode.cn/problems/add-two-numbers-ii/

可以直接用栈去做就行,逆序想到栈的做法 然后算完一个就直接赋值给答案数组 我用的是常见 public ListNode addTwoNumbers(ListNode l1, ListNode l2) { int sizeA=0; int sizeB=0; ListNode start=l1; Lis ......

Educational Codeforces Round 150 (Rated for Div. 2) C. Ranom Numbers

#include <iostream> #include <string> #include <cstring> #include <algorithm> #include <cmath> using namespace std; const int N=2e5+10; typedef long l ......
Educational Codeforces Numbers Round Rated

CodeForces 1841C Ranom Numbers

[洛谷传送门](https://www.luogu.com.cn/problem/CF1841C "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1841/C "CF 传送门") 先反转 $s$ 串,然后考虑 dp,设 $f_{ ......
CodeForces Numbers 1841C Ranom 1841

[LeetCode] 1351. Count Negative Numbers in a Sorted Matrix

Given a m x n matrix grid which is sorted in non-increasing order both row-wise and column-wise, return the number of negative numbers in grid. Exampl ......
LeetCode Negative Numbers Matrix Sorted

CF446C. DZY Loves Fibonacci Numbers

好牛的题,写一下。 题意:维护一个序列 $a$,长度为 $n$,有 $m$ 次操作: - `1 l r`:对于 $i\in[l,r]$,$a_i\leftarrow a_i+f_{i-l+1}$。 - `2 l r`:求 $\displaystyle\left(\sum_{i=l}^ra_i\rig ......
Fibonacci Numbers Loves 446 DZY

POJ2739 Sum of Consecutive Prime Numbers&&Acwing4938 连续质数之和

方法:单调队列 为什么是单调队列?因为这里让我们求连续的质数和,我们可以利用欧拉筛来维护质数,再利用单调队列来维护连续的质数。 代码( ~~POJ 不支持 C++ 11 差评~~): #include<cstdlib> #include<cstring> #include<cstdio> #incl ......
质数 之和 Consecutive amp Numbers

B. Sum of Two Numbers - 贪心+思维+构造

题意:   给定一个整数n,输出x,y满足以下要求:   1. x+y=n   2. x的每一位上的数加在一起的数位和和y的数位和相差不超过1. 分析:   从高位开始依次遍历,将其平均分给x和y,奇数剩余的1由x和y轮流加上。 代码: ......
思维 Numbers Sum Two of

Problem A. Restoring Numbers

Problem A. Restoring Numbers Pavel had two positive integers a and b. He found their sum s and greatest common divisor g, and forgot a and b after tha ......
Restoring Problem Numbers

Arrange the Numbers UVA - 11481

求 1∼n 的排列 A 中,满足前 m 个数中,刚好有 K 个数使得 A[ i ]=i 的 AA 的个数。 错位排列 #include<bits/stdc++.h> using namespace std; const int mod=1e9+7; #define int long long int ......
Arrange Numbers 11481 the UVA

CF449D Jzzhu and Numbers

CF449D Jzzhu and Numbers 黄金定律:给定序列求答案,但答案与序列顺序无关的题目,要么考虑把序列转权值序列,要么对序列排序。 二进制题按大小排序看起来就没啥用,那就转成权值序列。即,设 $c(i)$ 表示 $i$ 在 $a$ 中的出现次数。同时设 $V$ 为 $a$ 的值域。 ......
Numbers Jzzhu 449D 449 and

Apple iWork(Pages、Numbers、Keynote)13.0 - 文档、电子表格、演示文稿

请访问原文链接:https://sysin.org/blog/apple-iwork-13/,查看最新版。原创作品,转载请保留出处。 作者主页:sysin.org 苹果今天将其专为 iOS 和 macOS 设备设计的 iWork 应用套件更新为版本 12 (sysin),引入了许多新功能和改进功能。 ......
文稿 表格 Numbers Keynote 文档

两数相加-Add Two Numbers-中等

两数相加 Add Two Numbers [M] 题目: https://leetcode.cn/problems/add-two-numbers/description/?favorite=2cktkvj 讲解 https://www.youtube.com/watch?v=wgFPrzTjm7s ......
Numbers Add Two

Semi-prime H-numbers UVA - 11105

所有形如4n+1(n为非负整数)的数叫H数。定义1是唯一的单位H数, H素数是指本身不是1,且不能写成两个不是1的H数的乘积。 H-半素数是指能写成两个H素数的乘积的H数(这两个数可以相同也可以不同)。 例如,25是H-半素数,但125不是。 输入一个H数h(h≤1000001),输出1~h之间有多 ......
Semi-prime H-numbers numbers 11105 prime

Almost Prime Numbers UVA - 10539

#include <iostream> #include <cstring> #include <cmath> #include <algorithm> using namespace std ; const int M =1e6+33; #define int long long int b[M] ......
Numbers Almost 10539 Prime UVA

Sum of Consecutive Prime Numbers UVA - 121

#include <iostream> #include <cstring> #include <cmath> #include <algorithm> using namespace std ; const int M =1e4+33; int b[M],c[M],tot; int s[M] ; ......
Consecutive Numbers Prime Sum 121

C. Unlucky Numbers(数位dp)

题目 https://codeforces.com/contest/1808/problem/C 题意 给两个数 l 和 r $ ( 1 ≤ l ≤ r ≤ 10^{18})$ 请找出再这个范围内的一个数字,使得按数位这个数字中的数最大值和最小值之差最小 思路 当 l 和 r 的数位长度不一样时,可 ......
数位 Unlucky Numbers

Divisible Numbers

#include<iostream> #include<math.h> #include<string> #include<algorithm> using namespace std; typedef long long ll; const int N=1e5+10; int n; ll gcd( ......
Divisible Numbers
共56篇  :2/2页 首页上一页2下一页尾页