結果
問題 | No.2198 Concon Substrings (COuNt-CONstruct Version) |
ユーザー |
![]() |
提出日時 | 2023-01-20 21:48:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 819 bytes |
コンパイル時間 | 1,598 ms |
コンパイル使用メモリ | 169,680 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 09:44:34 |
合計ジャッジ時間 | 5,409 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 104 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ long long M; cin >> M; if (M == 0){ cout << "a" << endl; } else { vector<long long> A(4); A[0] = 1; A[1] = pow(M, (double) 1 / 3); A[2] = pow(M, (double) 2 / 3); A[3] = M; string ans; while (A[3] != 0){ if (A[3] >= A[2]){ ans += 'n'; A[3] -= A[2]; } else if (A[2] > A[1] && A[1] > 0){ ans += 'o'; A[2] -= A[1]; } else { ans += 'c'; A[1] -= A[0]; } } while (A[2] != 0){ if (A[2] >= A[1]){ ans += 'o'; A[2] -= A[1]; } else { ans += 'c'; A[1] -= A[0]; } } while (A[1] != 0){ ans += 'c'; A[1] -= A[0]; } reverse(ans.begin(), ans.end()); cout << ans << endl; } }