当前位置:网站首页>Cf365-e - Mishka and divisors, number theory +dp
Cf365-e - Mishka and divisors, number theory +dp
2022-07-25 15:34:00 【Brother Tazi is here】
The main idea of the topic :
to n ( n ≤ 1000 ) n(n \leq 1000) n(n≤1000) Number , Multiply with the least number to get k ( ≤ 1 e 12 ) k(\leq 1e12) k(≤1e12) Multiple .
Topic ideas :
Make d p ( i , j ) dp(i,j) dp(i,j) On behalf of i i i Number , Multiplicative gain j j j The minimum number of multiples of (01 knapsack )
j j j Take only k k k The divisor of .
For the first i i i Number , Transfer to :
d p ( i , j ) = m i n ( d p ( i − 1 , j ) , d p ( i − 1 , j g c d ( a i , j ) ) + 1 ) dp(i,j)=min(dp(i-1,j),dp(i-1,\frac{j}{gcd(a_i,j)})+1) dp(i,j)=min(dp(i−1,j),dp(i−1,gcd(ai,j)j)+1)
Why must it be from j g c d ( a i , j ) \frac{j}{gcd(a_i,j)} gcd(ai,j)j Transferred to the j j j Well ?
边栏推荐
- Cf888g clever dictionary tree + violent divide and conquer (XOR minimum spanning tree)
- 解决vender-base.66c6fc1c0b393478adf7.js:6 TypeError: Cannot read property ‘validate‘ of undefined问题
- 二进制补码
- Pytorch学习笔记--SEResNet50搭建
- JVM knowledge brain map sharing
- MySQL optimization summary II
- Pat class a topic directory
- Application of C language array in Sanzi chess -- prototype of Queen n problem
- 2021 Jiangsu race a Array line segment tree, maintain value range, Euler power reduction
- ML - natural language processing - Basics
猜你喜欢

GAMES101复习:变换

解决vender-base.66c6fc1c0b393478adf7.js:6 TypeError: Cannot read property ‘validate‘ of undefined问题

小波变换--dwt2 与wavedec2

Get the ask code corresponding to the key pressed by the keyboard

Games101 review: linear algebra

PAT甲级1152 Google Recruitment (20 分)

ML - 自然语言处理 - 关键技术

matlab 如何保存所有运行后的数据

谷歌云盘如何关联Google Colab

GAMES101复习:线性代数
随机推荐
PAT甲级1152 Google Recruitment (20 分)
Endnote 无法编辑range 解决
<栈模拟递归>
2021HNCPC-E-差分,思维
2019浙江省赛C-错排问题,贪心
Pytorch学习笔记-刘二老师RNN高级篇-代码注释及结果
组件化和模块化
Matlab randInt, matlab randInt function usage "recommended collection"
4PAM在高斯信道与瑞利信道下的基带仿真系统实验
CF888G-巧妙字典树+暴力分治(异或最小生成树)
Cf888g clever dictionary tree + violent divide and conquer (XOR minimum spanning tree)
Is it safe to open futures online? Which company has the lowest handling charge?
MySQL optimization summary II
MATLAB 如何生产随机复序列
解决vender-base.66c6fc1c0b393478adf7.js:6 TypeError: Cannot read property ‘validate‘ of undefined问题
C#精挑整理知识要点10 泛型(建议收藏)
Spark memory management mechanism new version
为什么PrepareStatement性能更好更安全?
Are you ready to break away from the "involution circle"?
matlab randint,Matlab的randint函数用法「建议收藏」