2010年5月13日 星期四
99/5/14 Java 長整數運算
import java.io.*;
import java.lang.Long;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.util.*;
class ffourteen
{
public static void main(String[] args)
{
String line;
long bi1,bi2,total;
try
{
FileReader inputjerry=new FileReader("input.txt");
BufferedReader binputjerry=new BufferedReader(inputjerry);
line=binputjerry.readLine();
StringTokenizer stline=new StringTokenizer(line, " ");
bi1=Long.parseLong(stline.nextToken());
System.out.println(bi1);
bi2=Long.parseLong(stline.nextToken());
System.out.println(bi2);
BigInteger bn1 = new BigInteger(stline.nextToken());
System.out.println(bn1);
BigInteger bn2 = new BigInteger(stline.nextToken());
System.out.println(bn2);
bn1=bn1.remainder(bn2);
System.out.println(bn1);
total =bi1+ bi2;
System.out.println(total);
FileWriter outputjerry=new FileWriter("outputtext.txt");
BufferedWriter boutputjerry=new BufferedWriter(outputjerry);
boutputjerry.write(String.valueOf(total));
boutputjerry.flush();
boutputjerry.close();
}
catch(Exception e)
{
System.out.println("Exception");
}
}
}
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言