Hdus 1097 a hard puzzle

Source: Internet
Author: User

A hard puzzle Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/32768 K (Java/Others)
Total submission (s): 28758 accepted submission (s): 10283


Problem descriptionlcy gives a hard puzzle to feng5166, LWG, jgshining And Ignatius: gave a and B, how to know the ^ 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 ^ B's the last digit number. but everybody is too lazy to slove this problem, so they remit to you who is wise.
 
Inputthere are mutiple test cases. Each test cases consists of two numbers a and B (0 <a, B <= 2 ^ 30)
 
Outputfor each test case, you should output the ^ B's last digit number.
 
Sample Input
7 668 800
 
Sample output
96
 


# Include <stdio. h> int main () {int A, B; while (scanf ("% d", & A, & B )! = EOF) {int I, last; A = A % 10; B = B % 4; last =; // The value of A must be assigned to lastif (B = 0) B = 4; for (I = 1; I <B; I ++) {last = A * last % 10;} printf ("% d \ n", last);} return 0 ;}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.