摘要:
一、树的直径 记录最长、次长,输出 \(max(最长+次长)\) \(AcWing\) \(1072\) 树的最长路径 #include <bits/stdc++.h> using namespace std; const int N = 10010, M = N << 1; int n; // n 阅读全文
摘要:
快速幂、龟速乘总结 一、快速幂 求 \(a^b\ mod \ p\) 的结果。 \(Code\) // 快速幂(不加mod) int qmi(int a, int b) { int res = 1; while (b) { if (b & 1) res = res * a; b >>= 1; a = 阅读全文