結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-07 01:43:34 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 934 bytes |
| コンパイル時間 | 112 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-10-14 11:02:56 |
| 合計ジャッジ時間 | 14,218 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 36 WA * 57 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 'w' * (-B) + 'C' * (-B - 1) + 'c' * A + 'C' * (A - 1) + 'W'
if A < 0 and B > 0:
return 'c' * (-A) + 'C' * (-A - 1) + 'w' * B + 'C' * (B - 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 * (abs(A) + abs(B)) - 1 <= 10000:
print(A, B)
return to_code(A, B)
return 'NO'
print(solve(x, y, z))
# %%
maspy