A - Leyland Number
Editorial
/
Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 100 点
問題文
正整数 A,B が与えられます。
A^B+B^A の値を出力してください。
制約
- 2 \leq A \leq B \leq 9
- 入力される数値はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
A B
出力
答えを整数として出力せよ。
入力例 1
2 8
出力例 1
320
A = 2, B = 8 のとき、A^B = 256, B^A = 64 なので A^B + B^A = 320 です。
入力例 2
9 9
出力例 2
774840978
入力例 3
5 6
出力例 3
23401
Score : 100 points
Problem Statement
You are given positive integers A and B.
Print the value A^B+B^A.
Constraints
- 2 \leq A \leq B \leq 9
- All input values are integers.
Input
The input is given from Standard Input in the following format:
A B
Output
Print the answer as an integer.
Sample Input 1
2 8
Sample Output 1
320
For A = 2, B = 8, we have A^B = 256, B^A = 64, so A^B + B^A = 320.
Sample Input 2
9 9
Sample Output 2
774840978
Sample Input 3
5 6
Sample Output 3
23401