zoukankan      html  css  js  c++  java
  • java学习(9):杭电1002.大数处理问题

    import java.math.BigDecimal;
    import java.util.Scanner;
    
    public class Main {
    
    	public static void main(String[] args) {
    		Scanner scanner = new Scanner(System.in);
    		String temp1 = null;
    		String temp2 = null;
    		String result = null;
    		int i;
    
    		int a = scanner.nextInt();
    		for (i = 0; i < a; i++) {
    			temp1 = scanner.next();
    			temp2 = scanner.next();
    
    			BigDecimal bigDecimal1 = new BigDecimal(temp1);
    			BigDecimal bigDecimal2 = new BigDecimal(temp2);
    
    			result = bigDecimal1.add(bigDecimal2).toString();
    			if (i != (a - 1)) {
    				System.out.println(
    						"Case " + (i + 1) + ":
    " + bigDecimal1 + " + " + bigDecimal2 + " = " + result + "
    ");
    			}else{
    				System.out.println(
    						"Case " + (i + 1) + ":
    " + bigDecimal1 + " + " + bigDecimal2 + " = " + result);
    			}
    
    		}
    
    	}
    
    }
    
  • 相关阅读:
    尚观寻求帮助
    linux软链接与硬连接
    linux常用命令(三)
    zend 动作控制器
    zend 路由
    ZF组件功能简介
    zend_controller
    linux常用命令(一)
    练习1
    练习1感受:
  • 原文地址:https://www.cnblogs.com/xcxfuryit/p/7355975.html
Copyright © 2011-2022 走看看