結果

問題 No.294 SuperFizzBuzz
ユーザー siman
提出日時 2021-10-19 15:42:16
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 759 bytes
コンパイル時間 4,469 ms
コンパイル使用メモリ 141,528 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-20 06:21:43
合計ジャッジ時間 6,990 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  int N;
  cin >> N;

  for (int d = 3; d <= 25; ++d) {
    for (int mask = 0; mask < (1 << d); ++mask) {
      if ((mask & 1) == 0) continue;
      if (__builtin_popcount(mask) % 3 != 0) continue;

      --N;
      if (N == 0) {
        string ans = "";
        for (int i = 0; i < d; ++i){
          if ((mask >> (d - i - 1)) & 1) {
            ans += "5";
          } else {
            ans += "3";
          }
        }
        cout << ans << endl;
        break;
      }
    }
  }

  return 0;
}
0