#include<stdio.h> #include<string.h> #include<string> #include<algorithm> using namespace std; int main() { int n; while (scanf("%d", &n) != EOF) { if (n == 0) { printf("1\n"); continue; } int count = n-1; int t = n % 10; while (count--) { t = t * n % 10; } printf("%d\n", t); } } |
Double click to view unformatted code.