Skip to content

Commit

Permalink
Add problem description at HighPrecisionNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
fatosmorina committed May 9, 2017
1 parent a74891b commit a2da0b6
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions UVa/HighPrecisionNumber.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@

/**
* A number with 30 decimal digits of precision can be represented by a structure type as shown in the
* examples below. It includes a 30-element integer array (digits), a single integer (decpt) to represent
* the position of the decimal point and an integer (or character) to represent the sign (+/-).
* Your task is to write a program to calculate the sum of high-precision numbers.
* Input
* The first line contains a positive integer n (1 ≤ n ≤ 100) indicating the number of groups of highprecision
* numbers (maximum 30 significant digits). Each group includes high-precision numbers (one
* number in a line) and a line with only 0 indicating the end of each group. A group can contain 100
* numbers at most.
* Output
* For each group, print out the sum of high-precision numbers (one value in a line). All zeros after the
* decimal point located behind the last non-zero digit must be discarded
*
* Sample Input
* 4
* 4.12345678900000000005
* -0.00000000012
* 0
* -1300.1
* 1300.123456789
* 0.0000000012345678912345
* 0
* 1500.61345975
* -202.004285
* -8.60917475
* 0
* -218.302869584
* 200.0000123456789
* 0
*
* Sample Output
* 4.12345678888000000005
* 0.0234567902345678912345
* 1290
* -18.3028572383211
*/

//https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2921


import java.math.BigDecimal;
import java.util.Scanner;

Expand Down

0 comments on commit a2da0b6

Please sign in to comment.