結果

問題 No.2614 Delete ABC
ユーザー MottchanMottchan
提出日時 2024-02-02 22:20:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 1,293 bytes
コンパイル時間 470 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 76,200 KB
最終ジャッジ日時 2024-02-02 22:21:01
合計ジャッジ時間 1,463 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
55,592 KB
testcase_01 AC 69 ms
70,672 KB
testcase_02 AC 74 ms
76,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
sys.set_int_max_str_digits(0)
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd, lcm, factorial, perm, comb
from itertools import product, permutations, combinations
from functools import lru_cache #@lru_cache(maxsize=128)
#重複あり:list(product(list('123'),repeat = 2)),重複なし:list(permutations(list('123')))
MOD = 998244353

t = int(input())
for _ in range(t):
    n = int(input())
    a = deque()
    b = deque()
    c = deque()
    for _ in range(n):
        a.append('A')
        b.append('B')
        c.append('C')
    
    ok=0
    aok=1
    ans=''
    for i in range(n):
        for j in range(3):
            if a:
                ans+=a.pop()
                if not ok:
                    ans+=b.pop()
                    ok=1
                else:
                    ans+=c.pop()
                    ok=0
            else:
                break
    if ok:
        while c and b:
            ans+=c.pop()
            ans+=b.pop()
    else:
        while c and b:
            ans+=b.pop()
            ans+=c.pop()
    
    if b:
        ans+=b.pop()
    if c:
        ans+=c.pop()
    print(ans)
0