結果

問題 No.677 10^Nの約数
ユーザー 37zigen37zigen
提出日時 2018-04-27 23:49:45
言語 Java19
(openjdk 21)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 810 bytes
コンパイル時間 2,153 ms
コンパイル使用メモリ 74,448 KB
実行使用メモリ 134,776 KB
最終ジャッジ日時 2023-09-10 07:01:31
合計ジャッジ時間 7,208 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 197 ms
134,648 KB
testcase_01 AC 196 ms
134,476 KB
testcase_02 AC 197 ms
134,516 KB
testcase_03 AC 200 ms
134,340 KB
testcase_04 AC 198 ms
134,648 KB
testcase_05 AC 198 ms
134,128 KB
testcase_06 AC 204 ms
134,588 KB
testcase_07 AC 201 ms
134,428 KB
testcase_08 AC 199 ms
134,692 KB
testcase_09 AC 201 ms
134,692 KB
testcase_10 AC 204 ms
134,440 KB
testcase_11 AC 208 ms
134,652 KB
testcase_12 AC 210 ms
134,420 KB
testcase_13 AC 209 ms
134,184 KB
testcase_14 AC 212 ms
134,552 KB
testcase_15 AC 221 ms
134,532 KB
testcase_16 AC 226 ms
134,776 KB
testcase_17 AC 225 ms
134,456 KB
testcase_18 AC 229 ms
134,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	long[][] comb = new long[3001][3001];
	long M;
	int N;

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d2 = n;
		int d5 = n;
		long[] div = new long[(1 + n) * (1 + n)];
		for (int i = 0; i <= n; ++i) {
			for (int j = 0; j <= n; ++j) {
				div[i + (1 + n) * j] = pow(2, i) * (pow(5, j));
			}
		}
		Arrays.sort(div);
		for (int i = 0; i < div.length; ++i) {
			System.out.println(div[i]);
		}

	}

	long pow(long a, long n) {
		long ret = 1;
		for (; n > 0; n >>= 1, a = a * a) {
			if (n % 2 == 1) {
				ret = ret * a;
			}
		}
		return ret;
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}
0