結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
mkawa2
|
| 提出日時 | 2020-04-24 15:08:37 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 994 bytes |
| コンパイル時間 | 134 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 17,700 KB |
| 最終ジャッジ日時 | 2024-10-15 01:53:06 |
| 合計ジャッジ時間 | 4,190 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| 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()
if mx//2*max(x,y)>z:
print("NO")
exit()
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()
mkawa2