結果
問題 | No.438 Cwwプログラミング入門 |
ユーザー |
![]() |
提出日時 | 2020-04-24 15:06:38 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 934 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 17,572 KB |
最終ジャッジ日時 | 2024-10-15 01:53:02 |
合計ジャッジ時間 | 3,929 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 TLE * 1 -- * 96 |
ソースコード
import sys sys.setrecursionlimit(10 ** 5) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] def extgcd(a,b,c): if b==0:return c//a,0,abs(a) x,y,g=extgcd(b,a%b,c) return y,x-y*(a//b),g def main(): mx=10000 x,y,z=MI() cx,cy,g=extgcd(x,y,z) if z%g: print("NO") exit() p=(cx>0)*2-1 while (abs(cx)+abs(cy))*2-1>mx and (cx>0)*2-1==p: cx,cy=cx-p*y,cy+p*x if (abs(cx)+abs(cy))*2-1>mx: print("NO") exit() if cx>0:ans="w"*abs(cy)+"c"*cx+"C"*(cx-1)+("C" if cy>0 else "W")*abs(cy) else:ans="c"*abs(cx)+"w"*cy+"C"*(cy-1)+("C" if cx>0 else "W")*abs(cx) print(ans) main()