#include <iostream>
using namespace std;
int main()
{
int a[10][4]={{0},{1},{6,2,4,8},{1,3,9,7},{6,4},{5},{6},{1,7,9,3},{6,8,4,2},{1,9}};
int b,n,num;
// while(
cin>>n;
// {
while(n--)
{
cin>>num;
b=num%10;
if(b==0 || b==1 || b==5 || b==6)
cout<<b<<endl;
else if(b==4 || b==9)
cout<<a[b][num%2]<<endl;
else if(b==2 || b==3 || b==7 || b==8)
cout<<a[b][num%4]<<endl;
}
// }
return 0;
}
找到规律后,直接打表
HDU 1061
最新推荐文章于 2020-02-11 20:34:14 发布