越来越懒了
难过
刷水题
规律题
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int ans[10][5]{ {0},{1},{2,4,8,6},{3,9,7,1},{4,6},{5},{6},{7,9,3,1},{8,4,2,6},{9,1} };
int main()
{
int n;
while (cin >> n)
{
int x = n % 10;
if (x == 0 || x == 1 || x == 5 || x == 6)
cout << ans[x][0] << endl;
else if (x == 4 || x == 9)
cout << ans[x][(n-1)% 2] << endl;
else
cout << ans[x][(n-1)% 4] << endl;
}
return 0;
}