結果
問題 | No.294 SuperFizzBuzz |
ユーザー |
|
提出日時 | 2020-09-10 22:28:50 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 844 bytes |
コンパイル時間 | 5,570 ms |
コンパイル使用メモリ | 115,868 KB |
最終ジャッジ日時 | 2025-01-14 09:20:11 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 TLE * 2 MLE * 1 |
ソースコード
#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; }