package javaapplication180;
import java.util.Scanner;
public class JavaApplication180 {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
while(scn.hasNext()){
long a=scn.nextLong();
long b=scn.nextLong();
int n=scn.nextInt();
String s=String.valueOf(a/b)+".";
long c=a-(a/b)*b;
for(int i=0;i<n;i++){
c=c*10;
s+=String.valueOf(c/b);
c=c%b;
}
System.out.println(s);
}
}
}
package javaapplication180;
import java.util.Scanner;
public class JavaApplication180 {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
while(scn.hasNext()){
long a=scn.nextLong();
long b=scn.nextLong();
int n=scn.nextInt();
String s=String.valueOf(a/b)+".";
long c=a-(a/b)*b;
for(int i=0;i<n;i++){
c=c*10;
s+=String.valueOf(c/b);
c=c%b;
}
System.out.println(s);
}
}
}
可以用 StringBuilder append 會比較快