結果

問題 No.294 SuperFizzBuzz
ユーザー ぴろず
提出日時 2015-10-23 22:40:20
言語 Java
(openjdk 23)
結果
AC  
実行時間 200 ms / 5,000 ms
コード長 685 bytes
コンパイル時間 2,303 ms
コンパイル使用メモリ 76,612 KB
実行使用メモリ 41,928 KB
最終ジャッジ日時 2024-07-23 01:28:51
合計ジャッジ時間 5,486 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

package no294;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int count = 0;
		for(int i=2;;i++) {
			int five = Integer.bitCount(i);
			int three = 32 - Integer.numberOfLeadingZeros(i) - five;
//			System.out.println(Integer.toBinaryString(i) + ":" + three + "," + five);
//			System.out.println(Integer.toBinaryString(i).replace('0', '3').replace('1', '5').substring(1) + "5");
			if (five % 3 == 0) {
				count++;
			}
			if (count == n) {
				System.out.println(Integer.toBinaryString(i).replace('0', '3').replace('1', '5').substring(1) + "5");
				return;
			}
		}
	}

}
0