結果

問題 No.746 7の倍数
ユーザー tentententen
提出日時 2022-08-03 09:37:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 1,192 bytes
コンパイル時間 4,045 ms
コンパイル使用メモリ 71,936 KB
実行使用メモリ 51,096 KB
最終ジャッジ日時 2023-10-09 23:54:29
合計ジャッジ時間 6,336 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,084 KB
testcase_01 AC 43 ms
49,552 KB
testcase_02 AC 41 ms
49,116 KB
testcase_03 AC 69 ms
51,032 KB
testcase_04 AC 46 ms
47,004 KB
testcase_05 AC 48 ms
49,432 KB
testcase_06 AC 62 ms
50,576 KB
testcase_07 AC 59 ms
50,812 KB
testcase_08 AC 60 ms
50,976 KB
testcase_09 AC 62 ms
50,440 KB
testcase_10 AC 50 ms
49,192 KB
testcase_11 AC 68 ms
48,740 KB
testcase_12 AC 69 ms
50,912 KB
testcase_13 AC 62 ms
50,780 KB
testcase_14 AC 68 ms
50,740 KB
testcase_15 AC 66 ms
51,088 KB
testcase_16 AC 66 ms
50,780 KB
testcase_17 AC 65 ms
50,744 KB
testcase_18 AC 65 ms
50,756 KB
testcase_19 AC 73 ms
51,096 KB
testcase_20 AC 60 ms
50,748 KB
testcase_21 AC 49 ms
49,344 KB
testcase_22 AC 67 ms
50,960 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.");
        while(n-- > 0) {
            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("");
    
    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