結果
問題 |
No.294 SuperFizzBuzz
|
ユーザー |
![]() |
提出日時 | 2015-10-23 23:50:01 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,096 bytes |
コンパイル時間 | 1,604 ms |
コンパイル使用メモリ | 95,232 KB |
実行使用メモリ | 565,876 KB |
最終ジャッジ日時 | 2024-09-13 04:02:52 |
合計ジャッジ時間 | 7,375 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 MLE * 1 |
other | -- * 12 |
ソースコード
#include <iostream> #include <cstdio> #include <cstring> #include <sstream> #include <algorithm> #include <math.h> #include <map> #include <functional> #include <iomanip> #include <vector> #include <queue> #include <stack> #include <set> #include <typeinfo> #define PI 3.14159265359 #define INF 99999999 #define rep(i, n) for(int i=0; i<n; i++) #define REP(n) rep(i, n) #define EPS 1e-10 #define pb push_back #define mp make_pair typedef long long ll; using namespace std; typedef pair<int, int> P; char *endptr; int kazu = 0; int N; typedef pair<int, string> PP; void bfs() { priority_queue<PP, vector<PP>, greater<PP> > que; que.push(PP(0, "")); while (true) { string s = que.top().second; que.pop(); //cout << "s = " << s << endl; if (s.length() > 25) break; ll num = strtoll(s.c_str(), &endptr, 10); //cout << "num = " << num << endl; if (num % 15 == 0) { kazu++; if (kazu == N) { cout << s << endl; break; } } que.push(PP(s.length() + 1, "3" + s)); que.push(PP(s.length() + 1, "5" + s)); } } int main() { cin >> N; bfs(); return 0; }