ZOJ-2476
2014-01-10 22:02
288 查看
又偷懒了。。JAVA里有format类,直接拿来用,省好多功夫
import java.text.DecimalFormat; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); while (n != 0) { double sum = 0; while (n-- > 0) { String s = sc.nextLine(); double d = Double.parseDouble(s.substring(1) .replaceAll(",", "")); sum += d; } System.out.println("$"+ new DecimalFormat("#,##0.00").format(sum)); n = sc.nextInt(); sc.nextLine(); } } }
相关文章推荐
- zoj 2476 Total Amount(水~)
- zoj_2476 Total Amount
- zoj 2476 Total Amount
- zoj 2476
- zoj 2476 Total Amount
- Total Amount zoj 2476
- ZOJ 2476 Total Amount 字符串
- ZOJ 2476 Total Amount 字符串
- 【求助】zoj 2476求和水题
- ZOJ 2476 Total Amount
- ZOJ Problem Set - 2476 Total Amount
- zoj 2476 Total Amount(模拟题,细节处理特别多)
- B-Total Amount (ZOJ 2476)
- ZOJ 2476 Total Amount (字符串处理)
- ZOJ 2476 Total Amount
- zoj 2476 Total Amount
- ZOJ 2476 Total Amount
- zoj 2476 Total Amount
- zoj 2476 Total Amount
- zoj 1622 Switch