結果

問題 No.2766 Delicious Multiply Spice
ユーザー tobbietobbie
提出日時 2024-06-08 15:40:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 858 bytes
コンパイル時間 1,836 ms
コンパイル使用メモリ 169,252 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-06-08 15:40:39
合計ジャッジ時間 13,848 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 10 ms
5,376 KB
testcase_20 AC 6 ms
5,376 KB
testcase_21 AC 284 ms
5,376 KB
testcase_22 AC 144 ms
5,376 KB
testcase_23 AC 115 ms
5,376 KB
testcase_24 AC 165 ms
5,376 KB
testcase_25 AC 964 ms
5,376 KB
testcase_26 WA -
testcase_27 AC 1,308 ms
5,376 KB
testcase_28 WA -
testcase_29 AC 1,385 ms
5,376 KB
testcase_30 AC 1,085 ms
5,376 KB
testcase_31 TLE -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i=0; i<(int)n; i++)
using ll = long long int;

int main() {
  ll N;
  cin >> N;
  auto dfs = [&](auto dfs, ll x, string S) {
    if (x == N) {
      rep(i, (int)S.size())
	cout << S[i];
      cout << endl;
      return true;
    }
    if (x == (N-1) / 2) {
      rep(i, (int)S.size())
	cout << S[i];
      cout << 'A' << endl;
      return true;
    }
    if (x == (N-1) / 3) {
      rep(i, (int)S.size())
	cout << S[i];
      cout << 'B' << endl;
      return true;
    }
    if (x > N)
      return false;
    bool ret = false;
    ret = (dfs(dfs, x * 4 + 3, S + "AA")) || ret;
    ret = (dfs(dfs, x * 6 + 3, S + "BA")) || ret;
    ret = (dfs(dfs, x * 6 + 4, S + "AB")) || ret;
    ret = (dfs(dfs, x * 9 + 4, S + "BB")) || ret;
    return ret;
  };
  dfs(dfs, 1, "");
  return 0;
}
0