結果

問題 No.25 有限小数
ユーザー ぴろずぴろず
提出日時 2014-12-19 09:26:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 114 ms / 5,000 ms
コード長 502 bytes
コンパイル時間 1,813 ms
コンパイル使用メモリ 76,016 KB
実行使用メモリ 41,892 KB
最終ジャッジ日時 2024-04-27 17:07:46
合計ジャッジ時間 5,918 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
41,340 KB
testcase_01 AC 104 ms
40,572 KB
testcase_02 AC 103 ms
41,540 KB
testcase_03 AC 94 ms
40,096 KB
testcase_04 AC 101 ms
40,540 KB
testcase_05 AC 114 ms
41,864 KB
testcase_06 AC 94 ms
40,156 KB
testcase_07 AC 107 ms
41,536 KB
testcase_08 AC 103 ms
41,004 KB
testcase_09 AC 93 ms
40,352 KB
testcase_10 AC 106 ms
41,384 KB
testcase_11 AC 96 ms
40,056 KB
testcase_12 AC 103 ms
40,592 KB
testcase_13 AC 111 ms
41,512 KB
testcase_14 AC 108 ms
41,080 KB
testcase_15 AC 99 ms
40,844 KB
testcase_16 AC 101 ms
40,744 KB
testcase_17 AC 108 ms
41,388 KB
testcase_18 AC 113 ms
41,532 KB
testcase_19 AC 108 ms
41,376 KB
testcase_20 AC 99 ms
40,360 KB
testcase_21 AC 112 ms
41,196 KB
testcase_22 AC 107 ms
41,248 KB
testcase_23 AC 104 ms
41,328 KB
testcase_24 AC 94 ms
40,096 KB
testcase_25 AC 98 ms
40,488 KB
testcase_26 AC 99 ms
40,536 KB
testcase_27 AC 105 ms
41,192 KB
testcase_28 AC 97 ms
40,536 KB
testcase_29 AC 114 ms
41,892 KB
testcase_30 AC 110 ms
41,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no025;

import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		BigDecimal n = new BigDecimal(sc.next());
		BigDecimal m = new BigDecimal(sc.next());
		try {
			BigDecimal ans = n.divide(m);
			ans = ans.stripTrailingZeros();
			String s = ans.unscaledValue().toString();
			System.out.println(s.charAt(s.length()-1));
		} catch (ArithmeticException e) {
			System.out.println(-1);
		}
	}
}
0