Skip to content

Commit 762c99f

Browse files
authored
Update the-eternal-immortality.cpp
1 parent 777317f commit 762c99f

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

869B/the-eternal-immortality.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
#include <iostream>
1+
#include <bits/stdc++.h>
22
using namespace std;
33

4-
typedef unsigned long long ull;
5-
64
int main() {
7-
ull a, b;
5+
long long a, b;
86
cin >> a >> b;
9-
10-
ull res = 1;
11-
for (ull i = a + 1; i <= b; i++) {
12-
res = (res % 10) * (i % 10);
13-
if (res % 10 == 0) break;
7+
long long ans = 1;
8+
for (long long i = a + 1; i <= b; i++) {
9+
ans = (ans % 10) * (i % 10);
10+
if (ans % 10 == 0) {
11+
break;
12+
}
1413
}
15-
cout << res % 10 << "\n";
16-
14+
cout << ans % 10 << endl;
1715
return 0;
1816
}

0 commit comments

Comments
 (0)