結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
t8m8⛄️
|
| 提出日時 | 2016-10-30 19:59:27 |
| 言語 | Nim (2.2.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,247 bytes |
| コンパイル時間 | 2,901 ms |
| コンパイル使用メモリ | 66,988 KB |
| 実行使用メモリ | 14,752 KB |
| 最終ジャッジ日時 | 2024-06-29 19:47:45 |
| 合計ジャッジ時間 | 7,225 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 2 |
| other | AC * 1 TLE * 1 -- * 96 |
ソースコード
import strutils, sequtils
var
input = stdin.readline.split.map(parseint)
(x, y, z) = (input[0], input[1], input[2])
if x == 0 and y == 0:
if z == 0:
echo("c")
else:
echo("NO")
quit()
if x == 0:
if z == 0:
echo("c")
else:
if z mod y == 0 and z div y*2-1 <= 10000:
var ans = ""
for i in 1..z div y:
ans = ans & "Cw"
echo(ans[1..ans.len])
else:
echo("NO")
quit()
if y == 0:
if z == 0:
echo("w")
else:
if z mod x == 0 and z div x*2-1 <= 10000:
var ans = ""
for i in 1..z div x:
ans = ans & "Cc"
echo(ans[1..ans.len])
else:
echo("NO")
quit()
for i in -5000..5000:
var a = i
if ((z - a*x) mod y != 0): continue
var
b = (z - a*x) div y
ans = ""
(f, g) = (false, false)
if a < 0:
a = -a
f = true
if b < 0:
b = -b
g = true
if g:
for i in 1..a:
if f: ans = ans & "Wc"
else: ans = ans & "Cc"
for i in 1..b:
if g: ans = ans & "Ww"
else: ans = ans & "Cw"
else:
for i in 1..b:
if g: ans = ans & "Ww"
else: ans = ans & "Cw"
for i in 1..a:
if f: ans = ans & "Wc"
else: ans = ans & "Cc"
echo(ans[1..ans.len])
quit()
echo("NO")
t8m8⛄️