快速切题 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 ...
随机推荐
- Winter-1-C A + B II 解题报告及测试数据
Time Limit:1000MS Memory Limit:32768KB Description I have a very simple problem for you. Given two i ...
- spark examples 导入idea并测试
记录下自己使用idea导入spark examples项目的过程. spark examples 项目可以给我们提供很多有益的参考,经常看看这些代码有助于提高我们写scala代码的水平. 只导入spa ...
- oracle 11g怎样配置才能连接远程数据库
打开所有程序->找到oracle-oradb11g-home1->Net Configuration Assistant,如图所示 选择本地网络服务名配置,点击下一步 选择添 ...
- GZFramework错误(升级修改)日志
sqlserver下事务中处理出现为初始化selectcommand的connection属性修改CommandDataBase中的PrepareCommand方法
- 【c++ primer, 5e】函数指针
简单的示例: #include <iostream> using namespace std; int sum(int x, int y) { return x + y; } int ma ...
- GRUB2 分析 (三)
接上一篇 从地址0x8200开始的是lzma_decompress.img.这是由startup_raw.S编译生成的.这个文件稍微复杂点.首先一开始就是个跳转指令: ljmp $0, $ABS(LO ...
- Junit中的setup和teardown方法
setup需要@before注解,实现测试前的初始化工作 teardown需要@after注解,测试完成后垃圾回收等后续工作
- wix toolset 用wixui 默认中文
light.exe .\test.wixobj -ext WixUIExtension -ext WixUtilExtension -cultures:zh-CN
- 移植gdb到海思3716板子的方法【转】
本文转载自:https://blog.csdn.net/yuhengyue/article/details/78414403 一,移植方法 环境:ubuntu12.04 交叉编译工具链路径:/opt/ ...
- JAVA启动参数整理[转]
java启动参数共分为三类: 其一是标准参数(-),所有的JVM实现都必须实现这些参数的功能,而且向后兼容: 其二是非标准参数(-X),默认jvm实现这些参数的功能,但是并不保证所有jvm实现都满足, ...