結果

問題 No.438 Cwwプログラミング入門
ユーザー ckawatakckawatak
提出日時 2019-04-20 16:54:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,538 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 658,876 KB
最終ジャッジ日時 2024-04-09 02:50:49
合計ジャッジ時間 26,465 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
60,292 KB
testcase_01 AC 38 ms
53,132 KB
testcase_02 AC 342 ms
58,112 KB
testcase_03 AC 345 ms
58,432 KB
testcase_04 AC 182 ms
216,212 KB
testcase_05 AC 123 ms
127,784 KB
testcase_06 AC 344 ms
58,916 KB
testcase_07 AC 342 ms
58,216 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 RE -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 347 ms
58,188 KB
testcase_14 RE -
testcase_15 AC 347 ms
58,620 KB
testcase_16 RE -
testcase_17 WA -
testcase_18 AC 347 ms
59,720 KB
testcase_19 AC 343 ms
59,372 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 RE -
testcase_23 WA -
testcase_24 AC 350 ms
58,572 KB
testcase_25 WA -
testcase_26 RE -
testcase_27 AC 347 ms
58,396 KB
testcase_28 RE -
testcase_29 WA -
testcase_30 AC 348 ms
58,492 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 RE -
testcase_34 RE -
testcase_35 WA -
testcase_36 WA -
testcase_37 RE -
testcase_38 AC 344 ms
57,984 KB
testcase_39 WA -
testcase_40 AC 344 ms
58,784 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 193 ms
58,968 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 RE -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 347 ms
59,372 KB
testcase_51 WA -
testcase_52 RE -
testcase_53 RE -
testcase_54 AC 346 ms
57,800 KB
testcase_55 RE -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 345 ms
59,408 KB
testcase_59 WA -
testcase_60 WA -
testcase_61 RE -
testcase_62 AC 344 ms
59,164 KB
testcase_63 WA -
testcase_64 WA -
testcase_65 AC 347 ms
58,696 KB
testcase_66 WA -
testcase_67 AC 341 ms
58,488 KB
testcase_68 RE -
testcase_69 WA -
testcase_70 RE -
testcase_71 TLE -
testcase_72 WA -
testcase_73 WA -
testcase_74 TLE -
testcase_75 WA -
testcase_76 RE -
testcase_77 WA -
testcase_78 MLE -
testcase_79 -- -
testcase_80 -- -
testcase_81 -- -
testcase_82 -- -
testcase_83 -- -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
testcase_88 -- -
testcase_89 -- -
testcase_90 -- -
testcase_91 -- -
testcase_92 -- -
testcase_93 -- -
testcase_94 -- -
testcase_95 -- -
testcase_96 -- -
testcase_97 -- -
testcase_98 -- -
testcase_99 -- -
testcase_100 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

MAX = 100000000

def bsearch(min, max, target):
    while min < max:
        middle = (min + max) // 2
        if middle == target:
            return middle
        elif middle < target:
            min = middle + 1
        elif target < middle:
            max = middle -1
        else:
            return -1

def encode(p, q, negative):
    code = []
    
    count = p // 2
    rest = p % 2
    for i in range(count):
        code.append('c')
        code.append('c')
        code.append('C')
    if rest:
        if 2 < count:
            code.append('c')
            code.append('C')
        else:
            code.append('c')
    
    count = q // 2
    rest = q % 2
    for i in range(count):
        code.append('w')
        code.append('w')
        code.append('C')
    if rest:
        if 2 < count:
            code.append('w')
            code.append('C')
        else:
            code.append('w')
    
    if negative:
        code.append('W')
    else:
        code.append('C')
    
    return ''.join(code)
        
X,Y,Z = list(map(int, input().split()))

# p * X + q * Y = Z
coef = None
negative = False
for p in range(MAX+1):
    rest = Z - p * X
    if rest % Y == 0:
        target = rest // Y
        if target < 0:
            negative = True
        q = bsearch(0, MAX+1, abs(target))
        if q != -1:
            coef = (p,q)
            break
        
if coef:
    p,q = coef
    code = encode(p, q, negative)
    if 10000 < len(code):
        print('NO')
    else:
        print(code)
else:
    print('NO')
0