zj 5 年之前
父节点
当前提交
83f7963874
共有 1 个文件被更改,包括 20 次插入0 次删除
  1. 20 0
      G.cpp

+ 20 - 0
G.cpp

@@ -0,0 +1,20 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main() {
+    int n;
+    cin >> n;
+    int s = 1;
+    int two = 0, five = 0;
+    for (int i = 2; i <= n; i++) {
+        int j = i;
+        while (j % 2 == 0)j /= 2, ++two;
+        while (j % 5 == 0)j /= 5, ++five;
+        s = (s * j) % 10;
+    }
+    two -= five;
+    while (two--)s = (s * 2) % 10;
+    cout << s << endl;
+    return 0;
+}