結果
| 問題 | 
                            No.2614 Delete ABC
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-02-02 22:20:59 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 79 ms / 2,000 ms | 
| コード長 | 1,293 bytes | 
| コンパイル時間 | 181 ms | 
| コンパイル使用メモリ | 81,856 KB | 
| 実行使用メモリ | 76,544 KB | 
| 最終ジャッジ日時 | 2024-09-28 10:42:57 | 
| 合計ジャッジ時間 | 836 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 2 | 
ソースコード
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)