結果

問題 No.858 わり算
ユーザー tentententen
提出日時 2020-08-31 15:22:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 1,948 ms
コンパイル使用メモリ 71,060 KB
実行使用メモリ 56,208 KB
最終ジャッジ日時 2023-08-10 01:36:18
合計ジャッジ時間 4,005 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,672 KB
testcase_01 AC 122 ms
55,772 KB
testcase_02 AC 124 ms
56,208 KB
testcase_03 AC 125 ms
55,960 KB
testcase_04 AC 123 ms
55,440 KB
testcase_05 AC 123 ms
54,276 KB
testcase_06 AC 122 ms
55,416 KB
testcase_07 AC 122 ms
55,656 KB
testcase_08 AC 125 ms
56,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	long a = sc.nextInt();
    	long b = sc.nextInt();
    	StringBuilder sb = new StringBuilder();
    	sb.append(a / b).append(".");
    	long mod = a % b;
    	for (int i = 0; i < 50; i++) {
    	    sb.append(mod * 10 / b);
    	    mod = mod * 10 % b;
    	}
    	System.out.println(sb);
    }
}
0