LASTDIG - The last digit
Nestor was doing the work of his math class about three days but he is tired of make operations a lot and he should deliver his task tomorrow. His math’s teacher gives him two numbers a and b. The problem consist of finding the last digit of the potency of base a and index b. Help Nestor with his problem. You are given two integer numbers: the base a (0 <= a <= 20) and the index b (0 <= b <= 2,147,483,000), a and b both are not 0. You have to find the last digit of ab.
Input
The first line of input contains an integer t, the number of test cases (t <= 30). t test cases follow. For each test case will appear a and b separated by space.
Output
For each test case output an integer per line representing the result.
Example
Input: 2 3 10 6 2
Output: 9 6
hide comments
Dyeison Carraro [FAJ]:
2013-08-30 16:26:08
700B? For that much? 450 is good... |
|
Lakshay Singhal:
2013-08-12 20:10:25
easy prob...done in both c++ nd python..
|
|
Ashish Tiwari:
2013-08-11 11:16:06
hai aasaan pr.... :( |
|
Raman Shukla:
2013-08-03 10:05:14
Very Easy problem... Silly mistake caused so many WAs... |
|
Pavan:
2013-07-26 09:11:27
yay accepted in first attempt
|
|
aman kumar jha:
2013-07-21 20:15:24
<3 python |
|
kashyap murthy:
2013-06-23 08:19:48
any other trick case other than 0 0 ? Last edit: 2013-06-23 08:20:00 |
|
orange:
2013-06-22 09:12:42
@kamalesh,thanks silly mistake caused me >10 WA |
|
Joey Tribbiani:
2013-06-13 06:54:51
I dont get it. Tried all inputs possible, gives the right output. Why is this WA on spoj? Please help. Any test case for which the output is wrong?
|
|
Ragesh:
2013-06-11 14:18:29
700 bytes limit is downright silly |
Added by: | Jose Daniel Rodriguez Morales |
Date: | 2008-12-01 |
Time limit: | 1s |
Source limit: | 700B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: GOSU |
Resource: | Own |