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.

Input
There are mutiple test cases. Each test cases consists of two numbers a and b(0<a,b<=2^30)

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
The problem means to find the power of a given number , Then take the last one ;
My thoughts ： Only the last digit determines the last digit , So first of all, ask for a Yes 10 Find the value of the remainder and assign it to a, Secondly, by finding the law, we can get , Every time 4 One cycle at a time , So we need b Yes 4 Find the value of the remainder and assign it to b; Next, I should understand , The code is as follows ;

```#include<stdio.h>
#include<math.h>
int main()
{
int a,b,c,d;
while(scanf("%d%d",&a,&b)!=EOF)
{
a=a%;b=b%;
if(b==)
b=;
c=pow(a,b);
d=c%;
printf("%d\n",d);
}
}```

## hdu 1097 A hard puzzle More articles about

1. hdu 1097 A hard puzzle Fast power modulus

Topic link :http://acm.hdu.edu.cn/showproblem.php?pid=1097 analysis : Simple questions , Fast power modulus , Since only the last bit is required to be output , So you can start right away mod10. /*A ha ...

2. hdu 5465 Clarke and puzzle Two dimensional line tree

Clarke and puzzle Time Limit: 1 Sec Memory Limit: 256 MB Topic linking http://acm.hdu.edu.cn/showproblem.php? ...

3. 【HDU 5456】 Matches Puzzle Game （ digit DP）

Matches Puzzle Game Problem Description As an exciting puzzle game for kids and girlfriends, the Mat ...

4. HDU 5465 Clarke and puzzle Nim game + Two dimensional tree array

Topic link : http://acm.hdu.edu.cn/showproblem.php?pid=5465 Clarke and puzzle  Accepts: 42  Submissions: 26 ...

5. ACM HDU 1755 -- A Number Puzzle

A Number Puzzle Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

6. mathematics -- number theory --HDU 1098 Ignatius's puzzle （ Fermat's small Theorem + The meter ）

Ignatius's puzzle Problem Description Ignatius is poor at math,he falls across a puzzle problem,so h ...

7. number theory - Combinatorial mathematics + Prime factorization --- hdu 2284 : Solve the puzzle, Save the world!

Solve the puzzle, Save the world! Problem Description In the popular TV series Heroes, there is a ta ...

8. HDU 4708:Rotation Lock Puzzle

Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

9. HDU 1098 Ignatius&#39;s puzzle( Mathematical induction )

The following is quoted from http://acm.hdu.edu.cn/discuss/problem/post/reply.php?postid=8466&messageid=2&deep=1 The meaning of the title is as follows ...

## Random recommendation

1. Andriod Custom control audio bar

Today we realize a direct inheritance from View New controls for . You all know the music player , When you click on a song to play , There's usually an area for the audio bar , Let's learn about it today , Player audio bar implementation . First of all, let's define a class , Directly following ...

2. postgresql Export data dictionary document

The project needs to sort out the data dictionary documents of the current database . The project is not standardized , This kind of document needs to be supplemented later . So many tables , Each field is written to word The document is really big . Even if a query table structure was written in the front sql, But in the end word It's still a bit of a hassle in my life . ...

3. python - socket - client End assignment ip And port

Problem description : There are... In the device 3 individual NI, ip Respectively 192.168.1.5/6/7. Where the local end 192.168.1.6 Same as opposite end 192.168.1.10 Set up a tunnel. I want to test tunnel Connectivity , From the opposite end ...

stay App Keep one in FMDatabaseQueue Example , And use only one instance in all threads . [FMDatabaseQueue databaseQueueWithPath:path]; FMDatab ...

5. POJ 1020 Anniversary Cake（DFS）

Anniversary Cake Time Limit: 1000MSMemory Limit: 10000KB64bit IO Format: %I64d & %I64u Submit St ...

6. Signalr Implement heartbeat package

Project analysis : A real-time IM Agent system , Client and agent use IM signal communication , Client side usage android and ios Of app, Seats use web. web The client can keep its own login status , But to prevent accidents ( If the browser is closed abnormally , Broken net ...

7. hdoj： Topic classification

Basic questions : 1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029.1032.1037.1040.1048.1056.1058. ...

8. How to use in multithreading scenario ArrayList

ArrayList Not thread safe , A lot of people know that , But the reason and performance of thread insecurity , How to use in multithreading ArrayList, Maybe not very clear , Here's a summary . 1. Source code analysis see ArrayList Of ...

9. kill prefix extra,endo out 1

1●extra Beyond the outside , Outside of the , outside Of   2●endo   Inside

10. ( fine ) character string ,map -&gt; json object -&gt;map( Beginners must read )

import java.util.LinkedList; import java.util.*; import java.util.ListIterator; import net.sf.json.J ...