Sgu 112 a ^ B-B ^

Source: Internet
Author: User


Java large number ....


A ^ B-B ^
Time limit:250 ms   Memory limit:4096kb   64bit Io format:% I64d & % i64u

[Submit] [Go Back] [Status]

Description

You are given natural numbers A and B. Find AB-ba.

Input

Input contains numbers a and B (1 ≤a, B ≤100 ).

Output

Write answer to output.

Sample Input

2 3

Sample output

-1

Source

[Submit] [Go Back] [Status]




import java.util.*;import java.math.*;public class Solution{public static void main(String[] args){Scanner cin=new Scanner(System.in);BigInteger a,b;int A,B;while(cin.hasNextInt()){A=cin.nextInt();B=cin.nextInt();a=BigInteger.valueOf(A);b=BigInteger.valueOf(B);BigInteger c=BigInteger.ZERO;c=a.pow(B).subtract(b.pow(A));System.out.println(c);}}}



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.