結果

問題 No.746 7の倍数
ユーザー x87asdf
提出日時 2018-11-08 01:45:17
言語 Java
(openjdk 23)
結果
AC  
実行時間 276 ms / 2,000 ms
コード長 611 bytes
コンパイル時間 2,171 ms
コンパイル使用メモリ 76,828 KB
実行使用メモリ 57,900 KB
最終ジャッジ日時 2024-11-20 20:56:51
合計ジャッジ時間 7,257 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        String pattern = "142857";
        String result = "0";
        
        if(n > 0) {
            result += "." + repeat(pattern, n/6);
            result += pattern.substring(0, n%6);
        }
        
        System.out.println(result);
    }
    
    public static String repeat(String str, int n) {
        String temp = "";
        for(int i=0;i<n;i++) {
            temp += str;
        }
        return temp;
    }
    
}
0