快速切题 sgu 112. a^b-b^a 大数 次方 难度:0 非java:1
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的更多相关文章
- 快速切题 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 ...
- 快速切题 poj 2993 Emag eht htiw Em Pleh 模拟 难度:0
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2806 Accepted: ...
- 快速切题 poj 3026 Borg Maze 最小生成树+bfs prim算法 难度:0
Borg Maze Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8905 Accepted: 2969 Descrip ...
- SGU 139. Help Needed! 逆序数,奇偶性,分析 难度:0
139. Help Needed! time limit per test: 0.25 sec. memory limit per test: 4096 KB Little Johnny likes ...
- windows下9款一键快速搭建PHP本地运行环境的好工具(含php7.0环境)
推荐几款一键快速搭建PHP本地运行环境的好工具(含php7.0及apache,nigix,mysql) 首推phpstudy2016和wampServer3.0.6 理由支持php7.0 目前 ...
- a^b-b^a - SGU 112(高精度快速幂)
分析:直接上吧,建议不要使用模板,否则没啥意义了. 代码如下: ==================================================================== ...
- SGU 112.a^b - b^a
题意: 如标题. 方法: 简单高精度... 代码(继续JAVA 水过) import java.util.*; import java.math.*; public class Solution { ...
- 快速切题sgu127. Telephone directory
127. Telephone directory time limit per test: 0.25 sec. memory limit per test: 4096 KB CIA has decid ...
- 快速切题sgu126. Boxes
126. Boxes time limit per test: 0.25 sec. memory limit per test: 4096 KB There are two boxes. There ...
随机推荐
- ZOJ - 4048 Red Black Tree (LCA+贪心) The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online
题意:一棵树上有m个红色结点,树的边有权值.q次查询,每次给出k个点,每次查询有且只有一次机会将n个点中任意一个点染红,令k个点中距离红色祖先距离最大的那个点的距离最小化.q次查询相互独立. 分析:数 ...
- 由浅入深之Tensorflow(4)----Saver&restore
x = tf.placeholder(tf.float32) y = tf.placeholder(tf.float32) w = tf.Variable(tf.zeros([1, 1], dtype ...
- 【Python】模块
廖雪峰教程笔记. [使用模块有什么好处?] 1.使用模块可以避免函数名和变量名冲突. 2.大大提高了代码的可维护性. [使用模块的注意点] 1.每一个.py文件就是一个模块. 2.每一个包目录下面必须 ...
- 从toString()方法到Object.prototype.toString.call()方法
一.toString方法和Object.prototype.toSting.call()的区别 var arr=[1,2]; 直接对一个数组调用toString()方法, console.log(ar ...
- 20145329 吉东云《Java程序设计》第二周学习总结
教材学习内容总结 第三章 基础语法 基本类型 1.整数(short.int.long) 2.字节(byte),可表示-128~127的整数 3.浮点数(float/double),主要储存小数数值 4 ...
- MR案例:WordCount改写
请参照wordcount实现一个自己的MapReduce,需求为: a. 输入文件格式: xxx,xxx,xxx,xxx,xxx,xxx,xxx b. 输出文件格式: ...
- GCC精彩之旅
在为Linux开发应用程序时,绝大多数情况下使用的都是C语言,因此几乎每一位Linux程序员面临的首要问题都是如何灵活运用C编译器.目前Linux下最常用的C语言编译器是GCC(GNU Compile ...
- AVL模板
感谢此博客 #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define de(x) cout &l ...
- Putting Apache Kafka To Use: A Practical Guide to Building a Stream Data Platform-part 2
转自: http://confluent.io/blog/stream-data-platform-2 http://www.infoq.com/cn/news/2015/03/ap ...
- 【Semantic Segmentation】 Instance-sensitive Fully Convolutional Networks论文解析(转)
这篇文章比较简单,但还是不想写overview,转自: https://blog.csdn.net/zimenglan_sysu/article/details/52451098 另外,读这篇pape ...