結果
| 問題 |
No.378 名声値を稼ごう
|
| コンテスト | |
| ユーザー |
takeya_okino
|
| 提出日時 | 2017-06-19 21:59:15 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 119 ms / 2,000 ms |
| コード長 | 620 bytes |
| コンパイル時間 | 2,563 ms |
| コンパイル使用メモリ | 83,512 KB |
| 実行使用メモリ | 41,368 KB |
| 最終ジャッジ日時 | 2024-06-30 01:26:48 |
| 合計ジャッジ時間 | 4,100 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long N = sc.nextLong();
long normal = 0;
long score = N;
for(int i = 0; i < 61; i++) {
if(score > 0) {
normal += score;
score /= 2;
} else {
break;
}
}
long skill = 0;
for(int i = 0; i < 61; i++) {
score = N;
long a = 0;
for(int j = 0; j < i; j++) {
a += score;
score /= 2;
}
a += (2 * score);
skill = Math.max(skill, a);
}
System.out.println(skill - normal);
}
}
takeya_okino