結果
問題 |
No.47 ポケットを叩くとビスケットが2倍
|
ユーザー |
![]() |
提出日時 | 2014-11-23 18:03:26 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 412 bytes |
コンパイル時間 | 3,411 ms |
コンパイル使用メモリ | 76,872 KB |
実行使用メモリ | 46,912 KB |
最終ジャッジ日時 | 2025-01-02 20:26:28 |
合計ジャッジ時間 | 7,366 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 3 WA * 18 |
ソースコード
import java.util.Scanner; public class CopyOfMain { public static void main(String[] args){ Scanner S = new Scanner(System.in); int N = S.nextInt(); int count=0; if(N==1) System.out.println(0); String n = Integer.toBinaryString(N+1); for(int i=0;i<n.length()-1;i++){ if(n.charAt(i) == '1') count += (n.length() -1 -i); } System.out.println(count); } }