1. 程式人生 > >pat(B)1017. A除以B(java大數)

pat(B)1017. A除以B(java大數)

程式碼:

import java.util.*;
import java.math.*;

public class Main
{
	public static void main(String args[])
	{
		Scanner cin=new Scanner(System.in);
		BigInteger a,b,q,r;
		while(cin.hasNext())
		{
			a=cin.nextBigInteger();
			b=cin.nextBigInteger();
			q=a.divide(b);
			r=a.mod(b);
			System.out.println(q+" "+r);
		}
	}
}