Innovation lab of Hunan University of Technology 2015 freshman competition (1) 1002 (reopened), Hunan 1002

Source: Internet
Author: User

Innovation lab of Hunan University of Technology 2015 freshman competition (1) 1002 (reopened), Hunan 1002
Time Limit: 3000/1000 ms (Java/Other) Memory Limit: 65535/32768 K (Java/Other) Total Submission (s): 39 Accepted Submission (s ): 23 Font: Times New Roman | Verdana | GeorgiaFont Size: Photo → Problem Description: The first handsome man of the art, the moon god, returned from Alibaba, ACM friends are naturally very happy!
Of course, they are so happy that they want to beat the moon in addition to the moon god.
After all, the moon god is rich and rich. In addition to treating guests, he will also answer questions from his friends.

However, as a result, the moon is overwhelmed by the sea, so he wants you to help and answer these questions on his behalf.

For each integer q, it indicates the problem. The integer p indicates the = q ^ p output. Input Multiple groups of Input, each group of Input two integers q and p (1 <= q <= 10, 1 <= p <= 9) Output for each group of data first Input a case #: # indicates the group of data
Then an integer a is output, indicating the result Sample Input.

1 12 23 3
Sample Output
case 1:1case 2:4case 3:27
Authorikids has nothing to say, that is, a = q ^ p. It is really afraid that timeout can be used as a quick power.
# Include <stdio. h> // # include <bits/stdc ++. h> # include <string. h> # include <iostream> # include <math. h> # include <sstream> # include <set> # include <queue> # include <vector> # include <algorithm> # include <limits. h> # define inf 0x3fffffff # define lson l, m, rt <1 # define rson m + 1, r, rt <1 | 1 # define LL long longusing namespace std; int pow (int x, int n) {int pw = 1; while (n> 0) {if (n & 1) // n & 1 is equivalent to (n % 2) = 1 pw * = x; x * = x; n >>=1; // n >>=1 is equivalent to n/= 2} return pw ;} int main () {int p, q; int num = 1; while (cin> p> q) {printf ("case % d: % d \ n ", num ++, pow (p, q);} return 0 ;}

  

Related Article

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.