結果

問題 No.378 名声値を稼ごう
ユーザー mits58mits58
提出日時 2016-07-23 00:59:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 295 bytes
コンパイル時間 2,683 ms
コンパイル使用メモリ 71,116 KB
実行使用メモリ 55,712 KB
最終ジャッジ日時 2023-09-12 01:05:47
合計ジャッジ時間 4,299 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,452 KB
testcase_01 AC 125 ms
55,712 KB
testcase_02 AC 126 ms
55,464 KB
testcase_03 AC 127 ms
55,688 KB
testcase_04 AC 125 ms
55,620 KB
testcase_05 AC 123 ms
55,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			long n=sc.nextLong();
			long sum=n/2;
			long max=n;
			n/=2;
			while(n>0){
				n/=2;
				sum+=n;
			}
			System.out.println(max-sum);
		}
	}
}
0