結果
| 問題 |
No.2610 Decreasing LCMs
|
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2024-01-19 22:09:47 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 125 ms / 1,000 ms |
| コード長 | 789 bytes |
| コンパイル時間 | 2,845 ms |
| コンパイル使用メモリ | 75,340 KB |
| 実行使用メモリ | 41,428 KB |
| 最終ジャッジ日時 | 2024-09-28 04:32:46 |
| 合計ジャッジ時間 | 6,254 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 22 |
ソースコード
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();
}
}
ks2m