結果

問題 No.746 7の倍数
ユーザー GrenacheGrenache
提出日時 2019-04-28 14:21:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 752 bytes
コンパイル時間 3,629 ms
コンパイル使用メモリ 73,700 KB
実行使用メモリ 57,624 KB
最終ジャッジ日時 2023-08-22 09:00:41
合計ジャッジ時間 9,103 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,824 KB
testcase_01 AC 122 ms
56,008 KB
testcase_02 AC 123 ms
56,136 KB
testcase_03 AC 144 ms
55,684 KB
testcase_04 AC 124 ms
55,988 KB
testcase_05 AC 131 ms
55,992 KB
testcase_06 AC 139 ms
57,624 KB
testcase_07 AC 138 ms
56,256 KB
testcase_08 AC 139 ms
53,892 KB
testcase_09 AC 137 ms
55,948 KB
testcase_10 AC 137 ms
55,892 KB
testcase_11 AC 138 ms
56,448 KB
testcase_12 AC 145 ms
55,824 KB
testcase_13 AC 140 ms
55,972 KB
testcase_14 AC 145 ms
55,424 KB
testcase_15 AC 144 ms
55,992 KB
testcase_16 AC 143 ms
55,808 KB
testcase_17 AC 141 ms
55,660 KB
testcase_18 AC 144 ms
56,116 KB
testcase_19 AC 141 ms
56,120 KB
testcase_20 AC 136 ms
55,644 KB
testcase_21 AC 135 ms
56,484 KB
testcase_22 AC 145 ms
55,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


public class Main_yukicoder746 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		if (n == 0) {
			pr.println(0);
		} else {
			String s7 = "142857";
			
			StringBuilder sb = new StringBuilder();
			sb.append("0.");
			for (int i = 0; i < n; i++) {
				sb.append(s7.charAt(i % s7.length()));
			}
			
			pr.println(sb);
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}
0