Blu_e
Blu_e
全部文章
分类
归档
标签
去牛客网
登录
/
注册
Blu_e的博客
全部文章
(共2篇)
题解 | 一道GCD问题
通过计算数组中两数的差值的g(最大公约数)来求数组中所有数加k后的公约数,因为数组中每个数加非负整数k不改变相邻两数的差值。设g为a,b的最大公约数,则a = g*m,b = g*n,a-b=g(m-n),显然g是a-b的公约数.求公约数用欧几里得算法,迭代求出所有差值的最大公约数.k值计算:若存在...
2025-12-25
0
29
题解 | 小红的字符串
#include <stdio.h> #include <string.h> //Brian Kernighan 算法 int count_binary(int n); int main() { int t; scanf("%d",&...
2025-12-24
1
25