N 的阶乘(记作 N!)是指从 1 到 N(包括 1 和 N)的所有整数的乘积。 阶乘运算的结果往往都非常的大。 现在,给定数字 N,请你求出 N! 的最右边的非零数字是多少。 例如 \(5!=1×2×3×4×5=120\),所以 5! 的最右边的非零数字是 2。 输入格式 共一行,包含一个整数 \ ...
https://www.acwing.com/problem/content/1143/ \(裸题\) #include <bits/stdc++.h> using namespace std; #define IO ios::sync_with_stdio(false);cin.tie(0); c ...
分类:
其他好文 时间:
2021-02-17 14:58:39
阅读次数:
0
https://www.acwing.com/problem/content/1144/ #include <bits/stdc++.h> using namespace std; #define IO ios::sync_with_stdio(false);cin.tie(0); cout.tie ...
分类:
其他好文 时间:
2021-02-17 14:57:50
阅读次数:
0
https://www.acwing.com/problem/content/1145/ 思路 \(把已有的边加上,会形成各个连通块,等价于把每个连通块当成一个点去做Kruskal算法.\) #include <bits/stdc++.h> using namespace std; #define ...
分类:
其他好文 时间:
2021-02-17 14:56:41
阅读次数:
0
高斯消元解线性方程组 时间复杂度:O(\(n^3\)) https://www.luogu.com.cn/problem/P3389 题意:给定一个线性方程组,对其求解。 #include <bits/stdc++.h> using namespace std; const char nl = '\ ...
分类:
其他好文 时间:
2021-02-17 14:54:53
阅读次数:
0
组合数学 方法一:预处理 + 递推 \(C_a^b = C_{a-1}^b + C_{a-1}^{b-1}\) 时间复杂度:O(\(n^2\)) #include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const ...
分类:
其他好文 时间:
2021-02-17 14:54:06
阅读次数:
0
题目链接:https://codeforces.com/contest/1480/problem/C 题解: 二分法。设定查找区间为$[1,n]$。若$a_<a_{mid+1}$若$a_>a_$,则$a_$为可行解。若$a_<a_$同理可得除非$a_n$在区间$[l,mid]$严格单调增加,否则必有 ...
分类:
其他好文 时间:
2021-02-17 14:36:41
阅读次数:
0
#include<bits/stdc++.h> #define N 300010 using namespace std; #define int long long int h[N],nxt[N],v[N],w[N],s,t,dep[N],ec,p[N],n,a[N],b[N],c[N],f[N] ...
分类:
其他好文 时间:
2021-02-17 14:04:51
阅读次数:
0
未完待续……(只是给自己存个板子) 快速傅里叶变换 #include <bits/stdc++.h> using namespace std; const int maxn = 2e6 + 1e2; struct Cp { double x, y; inline Cp operator +(cons ...
分类:
其他好文 时间:
2021-02-17 14:03:19
阅读次数:
0
A - Favorite Sound #include<bits/stdc++.h> using namespace std; const int N = 1e6 + 5; typedef long long LL; int main(){ int a, b, c; cin >> a >> b >> ...
分类:
其他好文 时间:
2021-02-16 12:44:42
阅读次数:
0