結果

問題 No.294 SuperFizzBuzz
ユーザー GrenacheGrenache
提出日時 2015-10-24 00:01:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 301 ms / 5,000 ms
コード長 885 bytes
コンパイル時間 3,738 ms
コンパイル使用メモリ 74,976 KB
実行使用メモリ 55,976 KB
最終ジャッジ日時 2023-10-11 04:52:52
合計ジャッジ時間 7,776 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
55,884 KB
testcase_01 AC 134 ms
55,760 KB
testcase_02 AC 299 ms
53,724 KB
testcase_03 AC 137 ms
55,580 KB
testcase_04 AC 135 ms
55,820 KB
testcase_05 AC 134 ms
55,788 KB
testcase_06 AC 136 ms
55,708 KB
testcase_07 AC 136 ms
55,976 KB
testcase_08 AC 155 ms
55,748 KB
testcase_09 AC 228 ms
55,704 KB
testcase_10 AC 235 ms
55,832 KB
testcase_11 AC 290 ms
55,712 KB
testcase_12 AC 290 ms
55,976 KB
testcase_13 AC 295 ms
55,760 KB
testcase_14 AC 301 ms
55,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder294 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int cnt = 0;
        out:
        for (int i = 1; i < 26; i++) {
        	for (int k = 0; k < 0x1 << i; k++) {
        		int tmp = Integer.bitCount(k) * 5 + (i - Integer.bitCount(k)) * 3;

        		if (tmp % 3 == 0 && (k & 0x1) != 0) {
        			cnt++;
        			if (cnt == n) {
        				String btmp = "";
                		for (int l = i - 1; l >= 0; l--) {
                			if ((k & 0x1 << l) == 0) {
                				btmp += "3";
                			} else {
                				btmp += "5";
                			}
                		}
        				System.out.println(btmp.toString());
        				break out;
        			}
        		}
        	}
        }

        sc.close();
    }
}
0