結果

問題 No.858 わり算
ユーザー shigeki_createshigeki_create
提出日時 2019-08-15 02:56:00
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 485 bytes
コンパイル時間 3,211 ms
コンパイル使用メモリ 77,032 KB
実行使用メモリ 57,828 KB
最終ジャッジ日時 2023-10-19 18:26:55
合計ジャッジ時間 4,627 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 149 ms
57,708 KB
testcase_02 AC 148 ms
57,692 KB
testcase_03 AC 148 ms
57,700 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 153 ms
57,828 KB
testcase_07 WA -
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();

		print(A/B + ".");

		A = A - A/B*B;

		for(int i=0; i<50; i++) {
			while(A < B && A!=0) A = A<B ? A*10 : A;
			int result = A/B;
			print(result);
			A = A - result*B;
		}
	}

	public static void print(Object o) {
		System.out.print(o);
	}

	public static void println(Object o) {
		System.out.println(o);
	}
}
0