結果

問題 No.746 7の倍数
ユーザー tentententen
提出日時 2022-10-06 13:00:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 1,253 bytes
コンパイル時間 2,072 ms
コンパイル使用メモリ 74,784 KB
実行使用メモリ 51,684 KB
最終ジャッジ日時 2023-08-30 23:41:33
合計ジャッジ時間 4,461 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,260 KB
testcase_01 AC 42 ms
49,288 KB
testcase_02 AC 42 ms
49,360 KB
testcase_03 AC 67 ms
50,880 KB
testcase_04 AC 45 ms
49,576 KB
testcase_05 AC 48 ms
49,660 KB
testcase_06 AC 69 ms
50,928 KB
testcase_07 AC 58 ms
51,124 KB
testcase_08 AC 59 ms
50,864 KB
testcase_09 AC 59 ms
50,996 KB
testcase_10 AC 47 ms
49,768 KB
testcase_11 AC 65 ms
51,132 KB
testcase_12 AC 66 ms
50,800 KB
testcase_13 AC 62 ms
50,876 KB
testcase_14 AC 66 ms
51,684 KB
testcase_15 AC 65 ms
50,836 KB
testcase_16 AC 65 ms
50,924 KB
testcase_17 AC 63 ms
50,848 KB
testcase_18 AC 66 ms
51,344 KB
testcase_19 AC 64 ms
50,920 KB
testcase_20 AC 60 ms
51,000 KB
testcase_21 AC 49 ms
49,340 KB
testcase_22 AC 66 ms
51,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        if (n == 0) {
            System.out.println(0);
            return;
        }
        int base = 1;
        StringBuilder sb = new StringBuilder("0.");
        for (int i = 0; i < n; i++) {
            base *= 10;
            sb.append(base / 7);
            base %= 7;
        }
        System.out.println(sb);
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0