From d481cadb74f3f24ba620350182949e8bd6291141 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Fri, 16 Jul 2021 22:02:27 +0800 Subject: [PATCH] =?UTF-8?q?P1134=20[USACO3.2]=E9=98=B6=E4=B9=98=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R53347070 --- Luogu/problem/P1134/P1134.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Luogu/problem/P1134/P1134.cpp diff --git a/Luogu/problem/P1134/P1134.cpp b/Luogu/problem/P1134/P1134.cpp new file mode 100644 index 00000000..8e8f2886 --- /dev/null +++ b/Luogu/problem/P1134/P1134.cpp @@ -0,0 +1,20 @@ +#include + +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; +}