結果
問題 | No.47 ポケットを叩くとビスケットが2倍 |
ユーザー |
![]() |
提出日時 | 2015-04-27 15:14:27 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 136 ms / 5,000 ms |
コード長 | 522 bytes |
コンパイル時間 | 3,340 ms |
コンパイル使用メモリ | 75,384 KB |
実行使用メモリ | 41,520 KB |
最終ジャッジ日時 | 2024-07-05 04:53:06 |
合計ジャッジ時間 | 7,352 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
import java.util.*; public class Yukicoder_47{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); int N = stdIn.nextInt(); boolean flag = true; if(N==1){ System.out.println(0); } else{ String str = Integer.toBinaryString(N); int count = str.length(); for(int i=1;i<str.length();i++){ char ch = str.charAt(i); if(ch == '1'){ flag = false; } } if(flag){ System.out.println(count-1); } else{ System.out.println(count); } } } }