摘要: 洛谷P3385 负环 #include<bits/stdc++.h> using namespace std; const int N = 2e3 + 10, M = 1e4 + 10, inf = 0x3f3f3f3f; int n, m, dis[N], cnt[N]; bool in[N]; 阅读全文
posted @ 2022-05-13 21:59 Faker_yu 阅读(32) 评论(0) 推荐(0)
摘要: *洛谷P4779 单源最短路径 #include<bits/stdc++.h> using namespace std; const int N = 1e5 + 10, M = 2e5 + 10, inf = 0x3f3f3f3f; int n, m, s, dis[N]; bool vis[N]; 阅读全文
posted @ 2022-05-13 21:43 Faker_yu 阅读(62) 评论(0) 推荐(0)
摘要: *洛谷P3811 乘法逆元 1.费马小定理: \(x' = x^{p-2}\) 2.线性递推求逆元:设 \(x'\) 表示 \(x\) 的逆元 对于 \(i\) ,求出 $t = p / i ,k = p % i $ 。 有 \(p = t \times i + k\) 。 所以 \(t \time 阅读全文
posted @ 2022-05-13 15:55 Faker_yu 阅读(36) 评论(0) 推荐(0)