結果
問題 | No.438 Cwwプログラミング入門 |
ユーザー | convexineq |
提出日時 | 2021-02-16 04:48:06 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 994 bytes |
コンパイル時間 | 1,551 ms |
コンパイル使用メモリ | 87,224 KB |
実行使用メモリ | 80,288 KB |
最終ジャッジ日時 | 2023-10-01 03:03:33 |
合計ジャッジ時間 | 17,338 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | AC | 69 ms
71,428 KB |
testcase_03 | AC | 67 ms
71,164 KB |
testcase_04 | AC | 67 ms
71,248 KB |
testcase_05 | AC | 68 ms
71,320 KB |
testcase_06 | AC | 69 ms
71,412 KB |
testcase_07 | AC | 68 ms
71,224 KB |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | AC | 66 ms
71,412 KB |
testcase_14 | RE | - |
testcase_15 | AC | 71 ms
71,276 KB |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | AC | 71 ms
71,308 KB |
testcase_19 | AC | 68 ms
71,428 KB |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | AC | 70 ms
71,320 KB |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | AC | 70 ms
71,516 KB |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | AC | 68 ms
71,436 KB |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | AC | 68 ms
71,196 KB |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | AC | 67 ms
71,516 KB |
testcase_39 | RE | - |
testcase_40 | AC | 68 ms
71,540 KB |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | AC | 69 ms
71,276 KB |
testcase_44 | RE | - |
testcase_45 | RE | - |
testcase_46 | RE | - |
testcase_47 | RE | - |
testcase_48 | RE | - |
testcase_49 | RE | - |
testcase_50 | AC | 66 ms
71,504 KB |
testcase_51 | AC | 67 ms
71,192 KB |
testcase_52 | RE | - |
testcase_53 | RE | - |
testcase_54 | AC | 68 ms
71,320 KB |
testcase_55 | RE | - |
testcase_56 | RE | - |
testcase_57 | RE | - |
testcase_58 | AC | 68 ms
71,416 KB |
testcase_59 | RE | - |
testcase_60 | RE | - |
testcase_61 | RE | - |
testcase_62 | AC | 71 ms
71,576 KB |
testcase_63 | RE | - |
testcase_64 | RE | - |
testcase_65 | AC | 71 ms
71,548 KB |
testcase_66 | RE | - |
testcase_67 | AC | 72 ms
71,408 KB |
testcase_68 | AC | 70 ms
71,416 KB |
testcase_69 | RE | - |
testcase_70 | RE | - |
testcase_71 | RE | - |
testcase_72 | RE | - |
testcase_73 | RE | - |
testcase_74 | RE | - |
testcase_75 | RE | - |
testcase_76 | AC | 70 ms
71,300 KB |
testcase_77 | RE | - |
testcase_78 | AC | 68 ms
71,444 KB |
testcase_79 | AC | 72 ms
71,112 KB |
testcase_80 | AC | 70 ms
71,672 KB |
testcase_81 | AC | 73 ms
71,376 KB |
testcase_82 | AC | 70 ms
71,504 KB |
testcase_83 | AC | 68 ms
71,312 KB |
testcase_84 | AC | 69 ms
71,324 KB |
testcase_85 | AC | 69 ms
71,116 KB |
testcase_86 | AC | 68 ms
71,280 KB |
testcase_87 | AC | 67 ms
71,508 KB |
testcase_88 | RE | - |
testcase_89 | RE | - |
testcase_90 | AC | 71 ms
71,588 KB |
testcase_91 | RE | - |
testcase_92 | AC | 69 ms
71,304 KB |
testcase_93 | AC | 69 ms
71,356 KB |
testcase_94 | AC | 69 ms
71,356 KB |
testcase_95 | RE | - |
testcase_96 | AC | 68 ms
71,324 KB |
testcase_97 | RE | - |
testcase_98 | AC | 69 ms
71,432 KB |
testcase_99 | AC | 71 ms
71,408 KB |
testcase_100 | RE | - |
ソースコード
def extgcd(x,y): if y==0: return x,1,0 #g=x r0,r1,s0,s1 = x,y,1,0 while r1 != 0: r0,r1, s0,s1 = r1,r0%r1, s1,s0-r0//r1*s1 return r0,s0,(r0-s0*x)//y from math import gcd x,y,z = map(int,input().split()) S = "cw" if x>y: x,y = y,x S = "wc" if z==0: print("ccW") exit() if y==0: print("NO") exit() g,A,B = extgcd(x,y) if z%g: print("NO") exit() x //= g; y //= g; z //= g def ans(A,B): if abs(A)+abs(B) > 5000: return if A >= 0 and B >= 0: s = S[0]*A+S[1]*B+"C"*(A+B-1) return s if A >= 0: B = -B s = S[1]*B+S[0]*A+"C"*(A-1)+"W"*B return s if B >= 0: A = -A s = S[0]*A+S[1]*B+"C"*(B-1)+"W"*A return s return A *= z; B *= z; A %= y B = (z-A*x)//y assert A*x+B*y==z s = ans(A,B) if s: print(s) assert cww(s,x,y)==z exit() AA = A-y BB = B+x assert AA*x+BB*y==z s = ans(AA,BB) if s: print(s) assert cww(s,x,y)==z exit() print("NO")