結果

問題 No.294 SuperFizzBuzz
コンテスト
ユーザー Grenache
提出日時 2015-10-23 23:56:17
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 3,314 ms / 5,000 ms
コード長 1,002 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,497 ms
コンパイル使用メモリ 83,680 KB
実行使用メモリ 43,772 KB
最終ジャッジ日時 2026-04-04 03:16:25
合計ジャッジ時間 24,625 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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 = 0;
        		for (int l = i - 1; l >= 0; l--) {
        			if ((k & 0x1 << l) == 0) {
        				tmp += 3;
        			} else {
        				tmp += 5;
        			}
        		}
        		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