結果
| 問題 | No.294 SuperFizzBuzz |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-10 22:28:50 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2,206 ms / 5,000 ms |
| コード長 | 844 bytes |
| 記録 | |
| コンパイル時間 | 1,373 ms |
| コンパイル使用メモリ | 87,320 KB |
| 実行使用メモリ | 462,192 KB |
| 最終ジャッジ日時 | 2026-06-13 12:56:13 |
| 合計ジャッジ時間 | 16,823 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using lint = long long;
void solve() {
int n;
std::cin >> n;
--n;
for (int m = 1;; ++m) {
std::vector<std::string> ss;
for (int b = 0; b < (1 << m); ++b) {
if ((b & 1) == 0 || __builtin_popcount(b) % 3 != 0) continue;
std::string s(m, '$');
for (int j = 0; j < m; ++j) s[j] = "35"[(b >> j) & 1];
std::reverse(s.begin(), s.end());
ss.push_back(s);
}
int k = ss.size();
if (k <= n) {
n -= k;
continue;
}
std::sort(ss.begin(), ss.end());
std::cout << ss[n] << "\n";
return;
}
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}