結果
問題 |
No.438 Cwwプログラミング入門
|
ユーザー |
![]() |
提出日時 | 2020-03-07 01:36:56 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 890 bytes |
コンパイル時間 | 357 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-10-14 11:02:20 |
合計ジャッジ時間 | 14,596 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 35 WA * 58 RE * 5 |
ソースコード
#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # %% x, y, z = map(int, read().split()) # %% def to_code(A, B): if A == B == 0: return 'ccW' if A == 0 and B > 0: return 'w' * B + 'C' * (B - 1) if A > 0 and B == 0: return 'c' * A + 'C' * (A - 1) if A > 0 and B > 0: return 'c' * A + 'w' * B + 'C' * (A + B - 1) if A > 0 and B < 0: return 'c' * A + 'C' * (A - 1) + 'w' * (-B) + 'C' * (-B - 1) + 'W' if A < 0 and B > 0: return 'w' * B + 'C' * (B - 1) + 'c' * (-A) + 'C' * (-A - 1) + 'W' def solve(x, y, z): for A in range(-5100, 5100): B = (z - A * x) // y if A * x + B * y == z: if 2 * (A + B) - 1 <= 10000: return to_code(A, B) return 'NO' print(solve(x, y, z))