結果

問題 No.294 SuperFizzBuzz
ユーザー simansiman
提出日時 2021-10-19 15:42:16
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 759 bytes
コンパイル時間 4,606 ms
コンパイル使用メモリ 130,768 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 10:47:04
合計ジャッジ時間 7,097 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
4,348 KB
testcase_01 AC 95 ms
4,348 KB
testcase_02 AC 86 ms
4,348 KB
testcase_03 AC 96 ms
4,348 KB
testcase_04 AC 95 ms
4,348 KB
testcase_05 AC 98 ms
4,348 KB
testcase_06 AC 105 ms
4,348 KB
testcase_07 AC 120 ms
4,348 KB
testcase_08 AC 95 ms
4,348 KB
testcase_09 AC 97 ms
4,348 KB
testcase_10 AC 49 ms
4,348 KB
testcase_11 AC 79 ms
4,348 KB
testcase_12 AC 82 ms
4,348 KB
testcase_13 AC 83 ms
4,348 KB
testcase_14 AC 86 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

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