mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-30 19:36:27 +00:00
21 lines
359 B
C++
21 lines
359 B
C++
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int n, ans = 1, a[] = {6, 8, 4, 2};
|
||
|
|
||
|
int main() {
|
||
|
cin >> n;
|
||
|
while (n) {
|
||
|
for (int i = 1; i <= n % 10; i++) {
|
||
|
if (i != 5) {
|
||
|
ans = ans * i % 10;
|
||
|
}
|
||
|
}
|
||
|
n = n / 5;
|
||
|
ans = ans * a[n % 4] % 10;
|
||
|
}
|
||
|
cout << ans << endl;
|
||
|
return 0;
|
||
|
}
|