結果

問題 No.438 Cwwプログラミング入門
ユーザー ckawatakckawatak
提出日時 2019-04-20 18:52:00
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,324 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 636,768 KB
最終ジャッジ日時 2024-04-09 20:18:44
合計ジャッジ時間 15,650 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
60,420 KB
testcase_01 AC 32 ms
53,136 KB
testcase_02 AC 295 ms
59,244 KB
testcase_03 AC 299 ms
57,916 KB
testcase_04 AC 236 ms
233,516 KB
testcase_05 AC 104 ms
146,288 KB
testcase_06 AC 294 ms
57,596 KB
testcase_07 AC 293 ms
58,344 KB
testcase_08 AC 32 ms
53,072 KB
testcase_09 AC 30 ms
52,620 KB
testcase_10 RE -
testcase_11 AC 33 ms
53,096 KB
testcase_12 AC 32 ms
53,036 KB
testcase_13 AC 298 ms
59,396 KB
testcase_14 RE -
testcase_15 AC 296 ms
58,352 KB
testcase_16 RE -
testcase_17 AC 32 ms
53,576 KB
testcase_18 AC 294 ms
58,364 KB
testcase_19 AC 295 ms
58,724 KB
testcase_20 AC 32 ms
53,348 KB
testcase_21 AC 31 ms
52,440 KB
testcase_22 RE -
testcase_23 AC 31 ms
52,832 KB
testcase_24 AC 294 ms
59,088 KB
testcase_25 AC 32 ms
53,208 KB
testcase_26 RE -
testcase_27 AC 296 ms
58,440 KB
testcase_28 RE -
testcase_29 AC 32 ms
52,128 KB
testcase_30 AC 296 ms
58,452 KB
testcase_31 AC 33 ms
53,536 KB
testcase_32 AC 33 ms
54,664 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 33 ms
53,568 KB
testcase_36 AC 32 ms
52,936 KB
testcase_37 RE -
testcase_38 AC 296 ms
58,000 KB
testcase_39 AC 33 ms
52,396 KB
testcase_40 AC 294 ms
58,380 KB
testcase_41 AC 33 ms
52,948 KB
testcase_42 AC 32 ms
52,448 KB
testcase_43 AC 164 ms
59,664 KB
testcase_44 AC 32 ms
53,292 KB
testcase_45 AC 32 ms
53,724 KB
testcase_46 RE -
testcase_47 AC 36 ms
52,884 KB
testcase_48 AC 37 ms
60,528 KB
testcase_49 WA -
testcase_50 AC 296 ms
59,168 KB
testcase_51 AC 38 ms
61,236 KB
testcase_52 RE -
testcase_53 RE -
testcase_54 AC 303 ms
59,284 KB
testcase_55 RE -
testcase_56 AC 40 ms
58,652 KB
testcase_57 WA -
testcase_58 AC 295 ms
59,456 KB
testcase_59 AC 39 ms
60,096 KB
testcase_60 AC 34 ms
52,824 KB
testcase_61 RE -
testcase_62 AC 296 ms
59,424 KB
testcase_63 WA -
testcase_64 AC 39 ms
60,964 KB
testcase_65 AC 298 ms
58,628 KB
testcase_66 AC 35 ms
53,700 KB
testcase_67 AC 294 ms
59,228 KB
testcase_68 RE -
testcase_69 AC 34 ms
52,960 KB
testcase_70 RE -
testcase_71 MLE -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
testcase_76 -- -
testcase_77 -- -
testcase_78 -- -
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 = []

    if positive:
        for _ in range(p):
            code.append('c')
        for _ in range(q):
            code.append('w')
        for _ in range(p+q-1):
            code.append('C')
    else:
        for _ in range(q):
            code.append('w')
        for _ in range(p):
            code.append('c')
        for _ in range(p-1):
            code.append('C')
        for _ in range(q):
            code.append('W')
    
    return ''.join(code)
        
X,Y,Z = list(map(int, input().split()))

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