結果

問題 No.746 7の倍数
ユーザー htensaihtensai
提出日時 2019-12-10 01:24:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 1,880 ms
コンパイル使用メモリ 71,660 KB
実行使用メモリ 56,368 KB
最終ジャッジ日時 2023-09-05 16:30:58
合計ジャッジ時間 5,947 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,048 KB
testcase_01 AC 114 ms
56,064 KB
testcase_02 AC 116 ms
56,332 KB
testcase_03 AC 138 ms
56,368 KB
testcase_04 AC 118 ms
56,052 KB
testcase_05 AC 129 ms
56,020 KB
testcase_06 AC 133 ms
55,804 KB
testcase_07 AC 131 ms
56,160 KB
testcase_08 AC 136 ms
56,088 KB
testcase_09 AC 131 ms
55,976 KB
testcase_10 AC 127 ms
56,212 KB
testcase_11 AC 135 ms
56,304 KB
testcase_12 AC 135 ms
56,040 KB
testcase_13 AC 132 ms
56,136 KB
testcase_14 AC 135 ms
56,208 KB
testcase_15 AC 139 ms
56,080 KB
testcase_16 AC 136 ms
56,144 KB
testcase_17 AC 133 ms
55,848 KB
testcase_18 AC 134 ms
55,920 KB
testcase_19 AC 133 ms
55,820 KB
testcase_20 AC 131 ms
56,204 KB
testcase_21 AC 134 ms
56,080 KB
testcase_22 AC 140 ms
56,184 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 cur = 10;
        for (int i = 0; i < n; i++) {
            sb.append(cur / 7);
            cur = (cur % 7) * 10;
        }
        System.out.println(sb);
    }
}
0