- chjshen 的博客
CSP-J2022
- 2023-1-8 18:21:58 @
T1:
#include<iostream>
using namespace std;
int main(void)
{
return 0;
}
pow(a, b);
brust-force:
= a* a* ... *a
for: 1- b
long long tim *= a;// tim < 10^9 a < 10^9
if(>10^9) return -1;
(10^9)
return tim;
solve:
$ 7 = (111)_2 = 1 \times2^0 + 1 \times2^1 + 1\times2^2$
b 二进制
T2:
$$\begin{aligned} & 设x = p, y = q, 则有 \\ & x \times y = n;\\ & e \times d = (x - 1)(y - 1) + 1 = x\times y -(x + y) + 2= n - (x + y) + 2 \\ & 则 x + y = n - e \times d + 2 \\ & x \times (n - e \times d + 2 - x) = n\\ & 设 n - e \times d + 2 = m \\ & x \times (m - x) = n;\\ & x^2 - mx + n = 0;\\ \end {aligned} $$$$\begin{aligned} & ax^2 + bx + c = 0;\\ &x_1 = \frac {-b + \sqrt{b^2-4ac}}{2a},x_2 = \frac {-b - \sqrt{b^2-4ac}}{2a}\\ & x_1 + x_2 = \frac {-2b}{2a} = -\frac b a \\ & x_1 x_2 = \frac{(-b + \sqrt{\Delta})(-b - \sqrt\Delta)}{{(2a)}^2}\\ & =\frac{b^2 - \Delta}{4a^2} = \frac { b^2 - (b^2 - 4ac)}{4a^2} = \frac {c}{a} \\ & x_1 x_2 = \frac c a\\ \end{aligned} $$T3:
逻辑运算:
and(&) 有一个为0,结果为0, 全1,结果是1, 1 & 0 = 0
or(|): 有一个为1, 结果是1,全0,结果是0
not(!): !1 = 0, !0 = 1
xor(^): 不进位的加法