112. a^b-b^a

time limit per test: 0.25 sec.
memory limit per test: 4096 KB

You are given natural numbers a and b. Find a^b-b^a.

Input

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

Output

Write answer to output.

Sample Input

2 3
Sample Output

-1

import java.io.*;
import java.math.BigInteger;
import java.util.Scanner; public class Main {
public static void main(String []args) throws IOException{
int a,b;
Scanner scanner=new Scanner(System.in);
a=scanner.nextInt();b=scanner.nextInt();
BigInteger A=BigInteger.valueOf(a);
BigInteger B=BigInteger.valueOf(b);
A=A.pow(b);B=B.pow(a);
A=A.subtract(B);
System.out.println(A);
}
}

  

快速切题 sgu 112. a^b-b^a 大数 次方 难度:0 非java:1的更多相关文章

  1. 快速切题 sgu 111.Very simple problem 大数 开平方 难度:0 非java:1

    111.Very simple problem time limit per test: 0.5 sec. memory limit per test: 4096 KB You are given n ...

  2. 快速切题 poj 2993 Emag eht htiw Em Pleh 模拟 难度:0

    Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2806   Accepted:  ...

  3. 快速切题 poj 3026 Borg Maze 最小生成树+bfs prim算法 难度:0

    Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8905   Accepted: 2969 Descrip ...

  4. SGU 139. Help Needed! 逆序数,奇偶性,分析 难度:0

    139. Help Needed! time limit per test: 0.25 sec. memory limit per test: 4096 KB Little Johnny likes ...

  5. windows下9款一键快速搭建PHP本地运行环境的好工具(含php7.0环境)

    推荐几款一键快速搭建PHP本地运行环境的好工具(含php7.0及apache,nigix,mysql) 首推phpstudy2016和wampServer3.0.6     理由支持php7.0 目前 ...

  6. a^b-b^a - SGU 112(高精度快速幂)

    分析:直接上吧,建议不要使用模板,否则没啥意义了. 代码如下: ==================================================================== ...

  7. SGU 112.a^b - b^a

    题意: 如标题. 方法: 简单高精度... 代码(继续JAVA 水过) import java.util.*; import java.math.*; public class Solution { ...

  8. 快速切题sgu127. Telephone directory

    127. Telephone directory time limit per test: 0.25 sec. memory limit per test: 4096 KB CIA has decid ...

  9. 快速切题sgu126. Boxes

    126. Boxes time limit per test: 0.25 sec. memory limit per test: 4096 KB There are two boxes. There ...

随机推荐

  1. hdu4763 Theme Section

    地址:http://acm.hdu.edu.cn/showproblem.php?pid=4763 题目: Theme Section Time Limit: 2000/1000 MS (Java/O ...

  2. centos7开启网卡功能

    centos7安装完成后,网卡默认是关闭的,未分配ip地址 解决办法: 1.cd /etc/sysconfig/network-scripts/ 2.ls查看网卡 3.修改该文件 vi ifcfg-e ...

  3. Struts2.5.12中动态方法调用问题

    使用版本:struts-2.5.12-all 出现问题:在开启动态方法调用后,找不到没有匹配的路径映射 <constant name="struts.enable.DynamicMet ...

  4. springCloud4---feign

    JAX-WS : soap是遵循这个标准. JAX-RS : 标准,jersey框架遵循这个标准. Feign是一个声明式的web service客户端.Feign使用的负载均衡也是ribbon,Fe ...

  5. POSIX 进程间通信 (可移植操作系统接口)

    1.什么是POSIX标准 Portable Operating System Interface for Computing System. 他是一个针对操作系统(准确地说是针对类Unix操作系统)的 ...

  6. C++ 单链表的实现

    #ifndef LINKEDLIST_H #define LINKEDLIST_H #define MAXLEN 256 template <class T> struct LinkedL ...

  7. MR案例:WordCount改写

    请参照wordcount实现一个自己的MapReduce,需求为:     a. 输入文件格式:        xxx,xxx,xxx,xxx,xxx,xxx,xxx     b. 输出文件格式:   ...

  8. [翻译]解读CSS中的长度单位

    测量,在WEB设计上是非常重要的.在CSS中有至少10种不同的测量单位.每种单位都有其独特的作用,使用它们,可以使页面,在各种设备上,很好的工作.一旦你熟悉了所有这些单位,你可以更准确地设定元素的大小 ...

  9. 【前端】jQuery选择器$()的实现原理

    今天三七互娱技术面试的时候面试官问了我这个问题,当时一脸懵逼,于是好好总结一下. 当我们使用jquery选择器的时候,$(s).回默认去执行jquery内部封装好的一个init的构造函数每次申明一个j ...

  10. Flume在企业大数据仓库架构中位置及功能

    Flume在企业大数据仓库架构中位置及功能 hadoop 数据仓库 flume 数据仓库架构 1.如下图所示,外部数据中,关系型数据库导入到HDFS用sqoop,由Nginx产生的文件实时监控用Flu ...