Skip to content

UVa 748

WinDaLex edited this page Sep 15, 2013 · 1 revision

Exponentiation

from Volume 1. Elementary Problem Solving :: Big Number

Description

输入R和n,求出R^n。

Solution

一道各个OJ几乎都有的高精度题目。可以直接用 Java 的 BigDecimal 类来撸。要学习一定的 Java 基础。

两个比较少用的函数要注意:

stripTrailingZeros( ) 如函数名所意,可以用来去除尾部的零,但是对形如0.00这样的数无效。replaceAll( )函数可以用来把特殊的字符串替换成另一个字符串,且可以用正则表达式,如 “^0” 的意思,就是首位0。

Clone this wiki locally