結果
問題 | No.294 SuperFizzBuzz |
ユーザー |
![]() |
提出日時 | 2020-05-12 11:24:47 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 783 ms / 5,000 ms |
コード長 | 808 bytes |
コンパイル時間 | 2,425 ms |
コンパイル使用メモリ | 76,988 KB |
実行使用メモリ | 54,160 KB |
最終ジャッジ日時 | 2024-09-13 04:48:16 |
合計ジャッジ時間 | 9,121 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
import java.util.*;public class Main {public static void main (String[] args) {Scanner sc = new Scanner(System.in);int n = sc.nextInt();int count = 0;int x = 0;int length = 1;while (count < n) {x = 0;while (count < n && x < (1 << length) - 1) {x++;if (isSuper(x)) {count++;}}length++;}StringBuilder sb = new StringBuilder();for (int i = 0; i < length - 1; i++) {if ((x & 1L) == 0) {sb.append("3");} else {sb.append("5");}x >>= 1;}sb.reverse();System.out.println(sb + "5");}static boolean isSuper(long x) {long count = 0;while (x > 0) {count += (x & 1L);x >>= 1;}return (count % 3 == 2);}}