結果

問題 No.294 SuperFizzBuzz
ユーザー ぴろずぴろず
提出日時 2015-10-23 22:40:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 173 ms / 5,000 ms
コード長 685 bytes
コンパイル時間 3,782 ms
コンパイル使用メモリ 73,732 KB
実行使用メモリ 56,520 KB
最終ジャッジ日時 2023-09-30 07:14:24
合計ジャッジ時間 6,057 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,816 KB
testcase_01 AC 117 ms
55,768 KB
testcase_02 AC 173 ms
55,828 KB
testcase_03 AC 120 ms
56,172 KB
testcase_04 AC 120 ms
56,308 KB
testcase_05 AC 117 ms
55,932 KB
testcase_06 AC 123 ms
55,736 KB
testcase_07 AC 119 ms
56,520 KB
testcase_08 AC 131 ms
56,068 KB
testcase_09 AC 150 ms
55,992 KB
testcase_10 AC 150 ms
55,900 KB
testcase_11 AC 166 ms
55,912 KB
testcase_12 AC 168 ms
55,756 KB
testcase_13 AC 161 ms
55,740 KB
testcase_14 AC 163 ms
56,108 KB
権限があれば一括ダウンロードができます

ソースコード

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