Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 44659 Accepted Submission(s): 16333
Problem Description lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than begin. this puzzle describes that: gave a and b,how to know the a^b’s the last digit number.But everybody is too lazy to slove this problem,so they remit to you who is wise.
Output For each test case, you should output the a^b’s last digit number.
Output For each test case, you should output the a^b’s last digit number. Sample Input 7 66 8 800
Sample Output 9 6
打表找规律代码
打表a从1-15,b从1-10找规律
#include <stdio.h> #include <iostream> using namespace std; int main() { for(int i=1;i<=15;i++) { long int sum=1; for(int j=1;j<=10;j++) { sum*=i; if(sum>100) sum%=100; cout<<sum%10<<" "; } cout<<endl; } return 0; }可以看出a从1-10顺序规律,b也可以看出每项规律。放入二维数组即可