結果

問題 No.294 SuperFizzBuzz
ユーザー GrenacheGrenache
提出日時 2015-10-24 00:06:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 218 ms / 5,000 ms
コード長 870 bytes
コンパイル時間 3,549 ms
コンパイル使用メモリ 74,080 KB
実行使用メモリ 56,148 KB
最終ジャッジ日時 2023-10-11 04:54:42
合計ジャッジ時間 6,965 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
55,924 KB
testcase_01 AC 128 ms
55,680 KB
testcase_02 AC 216 ms
55,488 KB
testcase_03 AC 129 ms
55,812 KB
testcase_04 AC 126 ms
55,736 KB
testcase_05 AC 131 ms
56,056 KB
testcase_06 AC 130 ms
55,848 KB
testcase_07 AC 130 ms
56,016 KB
testcase_08 AC 143 ms
55,824 KB
testcase_09 AC 188 ms
55,704 KB
testcase_10 AC 179 ms
55,764 KB
testcase_11 AC 208 ms
55,716 KB
testcase_12 AC 213 ms
55,648 KB
testcase_13 AC 212 ms
55,608 KB
testcase_14 AC 218 ms
56,148 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 = 3; i < 26; i++) {
        	for (int k = 1; k < 0x1 << i; k += 2) {
        		int tmp = Integer.bitCount(k) * 5 + (i - Integer.bitCount(k)) * 3;

        		if (tmp % 3 == 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