Hdu 2035 people see people love a^b

Source: Internet
Author: User
people see people love a^b

Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others) total submission (s): 34306 Accepted Submission (s): 23290

problem DescriptionAn integer representing the last three digits of the a^b. Description: The meaning of A^b is "A's B-square" InputThe input data contains multiple test instances, one row per instance, consisting of two positive integers a and B (1<=a,b<=10000), and if a=0, b=0, indicates the end of the input data and does not process.  Outputfor each test instance, output an integer representing the last three bits of a^b, one row for each output.  Sample Input2 366789 100000 0 Sample Output89841basic knowledge of elementary number theory, taking surplus
1#include <iostream>2 using namespacestd;3 intMain ()4 {5     intA, B;6      while(Cin >> a >>b)7     {8         if(A = =0&& b = =0)9              Break;Ten         intsum =1; One          for(inti =0; I < b; i++) A         { -sum = SUM *A; -             if(Sum > +) theSum%= +; -         } -cout << sum <<Endl; -     } +     return 0; -}
View Code

Hdu 2035 people see people love a^b

Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

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.