天天看点

2D. Rightmost Digit

D. Rightmost Digit

Time Limit: 1000ms

Case Time Limit: 1000ms

Memory Limit: 32768KB

64-bit integer IO format: %I64d      Java class name: Main

Given a positive integer N, you should output the most right digit of N^N.

The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.

Each test case contains a single positive integer N(1<=N<=1,000,000,000).

For each test case, you should output the rightmost digit of N^N.

Hint

In the first case, 3 * 3 * 3 = 27, so the rightmost digit is 7. In the second case, 4 * 4 * 4 * 4 = 256, so the rightmost digit is 6.

 ACM 新人,水题,找规律即可

2D. Rightmost Digit
2D. Rightmost Digit

View Code

夜空中最亮的星,照亮我前行