結果
| 問題 | No.1869 Doubling? |
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2022-03-11 22:11:32 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
RE
不安定
|
| 実行時間 | - |
| コード長 | 443 bytes |
| 記録 | |
| コンパイル時間 | 1,951 ms |
| コンパイル使用メモリ | 83,760 KB |
| 実行使用メモリ | 45,312 KB |
| 最終ジャッジ日時 | 2026-08-28 10:15:36 |
| 合計ジャッジ時間 | 6,678 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 9 RE * 14 |
ソースコード
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();
int m = sc.nextInt();
sc.close();
int[] a = new int[n];
a[0] = m;
long ans = m;
for (int i = 1; i < n; i++) {
if (a[i - 1] % 2 == 0) {
a[i] = a[i - 1] / 2;
} else {
a[i] = a[i - 1] / 2 + 1;
}
ans += a[i];
}
System.out.println(ans);
}
}
ks2m