Question G: "High precision" high precision number divided by low precision number I time limit: 1 Sec memory limit: MB
Submitted by: Resolution: 15
Submitted State [Discussion Version] Topic description Asura King gathered a large dark elements to display hidden magic, the magic will be in the surrounding space and time to create a hidden effect, of course, the effect of stealth depends on whether the dark elements are evenly distributed around the space-time, obviously this involves the programming of high-precision division. Considering the ability of the wolf to understand, Tabrets had to simplify the problem to: Enter a divisor (number of Bits ≤5000), enter a divisor (integer data range), output integer quotient, ignore decimal. Enter a total of two lines, the 1th behavior a numeric string, that is, the divisor, the 2nd behavior of an integer, that is, the divisor. Output output integer quotient, ignoring decimals. Sample input
205
Sample output
4 because it is easier to do it in Java, it is directly on the code.
Code:
ImportJava.math.BigInteger;ImportJava.util.Scanner; Public classMain { Public Static voidMain (string[] args) {Scanner sc=NewScanner (system.in); String St1=Sc.nextline (); String St2=Sc.nextline (); BigInteger B1=NewBigInteger (ST1); BigInteger B2=NewBigInteger (ST2);//b1.valueof (ST1);//b2.valueof (ST2);System.out.println (B1.divide (B2)); }}
PetroChina-High Precision Division-java version