結果

問題 No.746 7の倍数
ユーザー tentententen
提出日時 2020-10-14 13:17:13
言語 Java19
(openjdk 21)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 3,369 ms
コンパイル使用メモリ 72,580 KB
実行使用メモリ 56,428 KB
最終ジャッジ日時 2023-09-28 00:35:10
合計ジャッジ時間 5,699 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
55,976 KB
testcase_01 AC 107 ms
55,772 KB
testcase_02 AC 105 ms
55,844 KB
testcase_03 AC 124 ms
55,664 KB
testcase_04 AC 107 ms
55,644 KB
testcase_05 AC 117 ms
55,956 KB
testcase_06 AC 120 ms
55,960 KB
testcase_07 AC 120 ms
56,428 KB
testcase_08 AC 123 ms
55,736 KB
testcase_09 AC 121 ms
55,912 KB
testcase_10 AC 121 ms
55,720 KB
testcase_11 AC 129 ms
55,832 KB
testcase_12 AC 125 ms
56,008 KB
testcase_13 AC 127 ms
56,100 KB
testcase_14 AC 131 ms
55,836 KB
testcase_15 AC 127 ms
55,656 KB
testcase_16 AC 128 ms
55,876 KB
testcase_17 AC 122 ms
55,724 KB
testcase_18 AC 126 ms
56,032 KB
testcase_19 AC 125 ms
55,856 KB
testcase_20 AC 120 ms
55,660 KB
testcase_21 AC 116 ms
56,084 KB
testcase_22 AC 124 ms
55,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	if (n == 0) {
    	    System.out.println("0");
    	    return;
    	}
    	StringBuilder sb = new StringBuilder("0.");
    	int base = 1;
    	for (int i = 1; i <= n; i++) {
    	    base *= 10;
    	    sb.append(base / 7);
    	    base %= 7;
    	}
    	System.out.println(sb);
	}
}
0