結果
問題 |
No.2766 Delicious Multiply Spice
|
ユーザー |
|
提出日時 | 2024-05-31 21:28:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 637 bytes |
コンパイル時間 | 2,003 ms |
コンパイル使用メモリ | 167,684 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-20 22:26:11 |
合計ジャッジ時間 | 2,956 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 WA * 2 |
other | AC * 6 WA * 25 |
ソースコード
#include <iostream> #include <bits/stdc++.h> std::string find_operations(int N) { if (N == 1) return ""; std::string operations; while (N > 1) { if ((N - 1) % 3 == 0) { N = (N - 1) / 3; operations += 'B'; } else { N = (N - 1) / 2; operations += 'A'; } } // Reverse the string to get operations from x=1 to x=N reverse(operations.begin(), operations.end()); return operations; } int main() { int N; std::cin >> N; std::string result = find_operations(N); std::cout << result << std::endl; return 0; }