結果

問題 No.378 名声値を稼ごう
ユーザー nCk_cvnCk_cv
提出日時 2016-07-01 20:36:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 2,116 ms
コンパイル使用メモリ 71,524 KB
実行使用メモリ 55,808 KB
最終ジャッジ日時 2023-09-12 00:56:00
合計ジャッジ時間 3,265 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,404 KB
testcase_01 AC 121 ms
55,784 KB
testcase_02 AC 121 ms
55,808 KB
testcase_03 AC 120 ms
55,716 KB
testcase_04 AC 122 ms
55,620 KB
testcase_05 AC 122 ms
55,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.math.*;
import java.util.*;


public class Main {
	static int[] vy = {1,0,-1,0};
	static int[] vx = {0,1,0,-1};
	public static void main(String[] args) {	
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		long in = sc.nextLong();
		long sum = 0;
		long max = 0;
		while(in != 0) {
			max = Math.max(max, sum + in*2);
			sum += in;
			in /= 2;
		}
		System.out.println(max - sum);
	}
}
0