首页 > 其他分享 >Math Record

Math Record

时间:2024-02-21 21:44:29浏览次数:14  
标签:lfloor dfrac rfloor A1 Record A2 B1 Math

T1.oj6785你还没有卸载吗(game)

先得出式子:

\[B_1+\lfloor\dfrac{A_1}{x}\rfloor = B_2+\lfloor \dfrac{A_2}{x}\rfloor \]

然后把 \(B_2\) 移过去,把 \(\lfloor\dfrac{A_1}{x}\rfloor\) 移过来就可以得到:

\[B_1 - B_2 = \lfloor \dfrac{A_2}{x}\rfloor - \lfloor\dfrac{A_1}{x}\rfloor \]

然后再用类似整除分块的想法搞一下,这样就可以求出 \(x\) 的种数了。

代码:

void solve()
{
    int A1,B1,A2,B2,n,ans = 0;
    cin >> A1 >> B1 >> A2 >> B2 >> n;
    for(int l = 1,r = 1;l <= n;l = r + 1,r = min({n,l > A1 ? n : A1 / (A1 / l),l > A2 ? n : A2 / (A2 / l)}))
    {
        if(A2 / l - A1 / l == B1 - B2)
        {
            ans += r - l + 1;
        }
    }
    cout << ans << '\n';
}

标签:lfloor,dfrac,rfloor,A1,Record,A2,B1,Math
From: https://www.cnblogs.com/Carousel/p/18026277

相关文章

  • SciTech-Mathmatics-Multiplication Properties
    https://byjus.com/maths/multiplication/Inmathematics,multiplicationisamethodoffindingtheproductoftwoormorenumbers.Itisoneofthebasicarithmeticoperations,thatweuseineverydaylife.Themajorapplicationwecanseeinmultiplicatio......
  • SciTech-Mathmatics-LinearAlgebra-特征值和特征向量
    1基本定义将\(n\)阶方阵\(M\)分解出如下式的非零n维向量\(v\)作为特征向量和\(\lambda\)作为特征向量;$\largeMv=\lambdav,\v\neq0$上式不仅可以分解出,甚至还可以分解出多个特征向量与特征值;实例:对物体施加作用力F产生运动,运动可以分解到3D空间......
  • SciTech-Mathmatics-UNIQUE FACTORIZATION THEOREM
    SciTech-Mathmatics-UNIQUEFACTORIZATIONTHEOREMElementary_Number_Theory:https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/Elementary_Number_Theory_(Clark)/01%3A_Chapters/1.11%3A_Unique_Factorizationhttps://public.csusm.edu/......
  • SciTech-Math-Complex:复数 + Abraham de Moivre French mathematician
    (AbrahamdeMoivre,Frenchmathematician)两个复数乘积的结果:模等于两者模相乘,弧角等于两者弧角相加;\(极坐标\)表示,若:\(\largez_{1}=\rho_{1}(\cos{\theta_{1}}+i*{\sin{\theta_{1}}})\)\(\largez_{2}=\rho_2(\cos{\theta_{1}}+i*\sin{\theta_{2}})\)则:\(......
  • [Maths] 数学做题记录
    P7481梦现时刻由题得:\[F(a,b)=\sum_{i=0}^{b}\dbinom{b}{i}\dbinom{n-i}{a}\]根据公式\(\displaystyle\dbinom{n}{m}=\dbinom{n-1}{m-1}+\dbinom{n-1}{m}\),有:\[F(a,b)=\sum_{i=0}^{b}\dbinom{b-1}{i-1}\dbinom{n-i}{a}+\sum_......
  • 无涯教程-Math.atan2(y, x0)函数
    atan2方法介于-PI/2与PI/2弧度之间的数值来返回x的反正切值。Math.atan2-语法Math.atan2(x,y)x和y  - 代表一个数字Math.atan2-示例console.log("---Math.atan2()---")console.log("Math.atan2(0):"+Math.atan2(0,1))console.log("Math.atan2(M......
  • 无涯教程-Math.acos(x)函数
    此函数返回x的反余弦值。Math.acos(x)-语法Math.acos(x)x  - 代表数字Math.acos(x)-示例console.log("---Math.acos()---")console.log("Math.acos(0):"+Math.acos(0))console.log("Math.acos(Math.SQRT1_2):"+Math.acos(Math.SQRT1_2))......
  • 无涯教程-Math.asin(x)函数
    此函数返回x的反正弦。Math.asin(x)-语法Math.asin(x)x  - 代表数字Math.asin(x)-示例console.log("---Math.asin()---")console.log("Math.asin(0):"+Math.asin(0))console.log("Math.asin(Math.SQRT1_2):"+Math.asin(Math.SQRT1_2))......
  • 无涯教程-Math.max((x1, x2,...)函数
    此方法返回零或多个数字中的最大值。如果未提供任何参数,则输出为–Infinity。Math.max-语法Math.max(x1,x2,x3..)X1,x2,x3..  - 代表一系列数字Math.max-示例console.log("---Math.max()---")console.log("Math.max(3,0.5,0.66):"+Math.max(3,0.5,......
  • 无涯教程-Math.round(x)函数
    将数字四舍五入到最接近的整数。Math.round(x)-语法Math.round(x);x  - 代表数字Math.round(x)-示例console.log("---Math.round()---")console.log("Math.round(7.2):"+Math.round(7.2))console.log("Math.round(-7.7):"+Math.round(-7.......