結果

問題 No.294 SuperFizzBuzz
ユーザー maine_honzuki
提出日時 2021-05-14 11:36:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 176 ms / 5,000 ms
コード長 666 bytes
コンパイル時間 1,912 ms
コンパイル使用メモリ 193,420 KB
最終ジャッジ日時 2025-01-21 10:51:12
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

//https://ncode.syosetu.com/n4830bu/294/
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N;
    cin >> N;
    for (int len = 1;; len++) {
        for (int bit = 0; bit < (1 << len); bit++) {
            if ((bit & 1) && __builtin_popcount(bit) % 3 == 0) {
                N--;
                if (!N) {
                    for (int i = len - 1; i >= 0; i--) {
                        if (bit & (1 << i))
                            cout << 5;
                        else
                            cout << 3;
                    }
                    cout << endl;
                    return 0;
                }
            }
        }
    }
}
0