結果

問題 No.746 7の倍数
ユーザー x87asdfx87asdf
提出日時 2018-11-08 01:45:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 611 bytes
コンパイル時間 2,558 ms
コンパイル使用メモリ 76,768 KB
実行使用メモリ 46,780 KB
最終ジャッジ日時 2024-04-30 22:36:37
合計ジャッジ時間 7,474 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
41,096 KB
testcase_01 AC 137 ms
42,660 KB
testcase_02 AC 139 ms
42,732 KB
testcase_03 AC 268 ms
46,652 KB
testcase_04 AC 133 ms
43,108 KB
testcase_05 AC 132 ms
46,220 KB
testcase_06 AC 181 ms
46,752 KB
testcase_07 AC 167 ms
46,776 KB
testcase_08 AC 181 ms
46,472 KB
testcase_09 AC 148 ms
45,852 KB
testcase_10 AC 143 ms
46,660 KB
testcase_11 AC 214 ms
46,724 KB
testcase_12 AC 264 ms
46,492 KB
testcase_13 AC 204 ms
46,432 KB
testcase_14 AC 203 ms
46,296 KB
testcase_15 AC 196 ms
46,516 KB
testcase_16 AC 197 ms
46,260 KB
testcase_17 AC 197 ms
46,676 KB
testcase_18 AC 218 ms
46,620 KB
testcase_19 AC 206 ms
46,600 KB
testcase_20 AC 158 ms
46,388 KB
testcase_21 AC 158 ms
46,636 KB
testcase_22 AC 231 ms
46,780 KB
権限があれば一括ダウンロードができます

ソースコード

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