結果

問題 No.2610 Decreasing LCMs
ユーザー ks2mks2m
提出日時 2024-01-19 22:09:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 145 ms / 1,000 ms
コード長 789 bytes
コンパイル時間 2,924 ms
コンパイル使用メモリ 74,880 KB
実行使用メモリ 57,960 KB
最終ジャッジ日時 2024-01-19 22:09:54
合計ジャッジ時間 7,129 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
57,812 KB
testcase_01 AC 130 ms
57,960 KB
testcase_02 AC 130 ms
57,680 KB
testcase_03 AC 132 ms
57,656 KB
testcase_04 AC 136 ms
56,116 KB
testcase_05 AC 145 ms
57,940 KB
testcase_06 AC 139 ms
57,828 KB
testcase_07 AC 132 ms
57,792 KB
testcase_08 AC 133 ms
57,700 KB
testcase_09 AC 132 ms
57,940 KB
testcase_10 AC 129 ms
57,704 KB
testcase_11 AC 130 ms
57,572 KB
testcase_12 AC 131 ms
57,832 KB
testcase_13 AC 140 ms
57,840 KB
testcase_14 AC 131 ms
57,700 KB
testcase_15 AC 129 ms
57,576 KB
testcase_16 AC 130 ms
57,948 KB
testcase_17 AC 139 ms
57,592 KB
testcase_18 AC 130 ms
57,844 KB
testcase_19 AC 137 ms
57,840 KB
testcase_20 AC 136 ms
57,716 KB
testcase_21 AC 133 ms
57,844 KB
testcase_22 AC 134 ms
57,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		int[] a = new int[n + 1];
		a[0] = 1 << (n - 1);
		for (int i = 1; i <= n; i++) {
			a[i] = a[0] + (1 << (i - 1));
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 1; i <= n; i++) {
			sb.append(a[i]).append(' ');
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());

//		for (int i = 1; i < n; i++) {
//			System.out.println(lcm(a[i], a[i + 1]));
//		}
	}

	static long lcm(long a, long b) {
		BigInteger ba = BigInteger.valueOf(a);
		BigInteger bb = BigInteger.valueOf(b);
		return ba.multiply(bb).divide(ba.gcd(bb)).longValue();
	}
}
0