結果

問題 No.113 宝探し
ユーザー MaboyMaboy
提出日時 2021-06-04 21:14:06
言語 Swift
(5.10.0)
結果
WA  
実行時間 -
コード長 218 bytes
コンパイル時間 7,265 ms
コンパイル使用メモリ 118,224 KB
実行使用メモリ 9,216 KB
最終ジャッジ日時 2024-04-30 01:11:39
合計ジャッジ時間 8,262 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 8 ms
9,088 KB
testcase_14 AC 8 ms
8,960 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 9 ms
8,960 KB
testcase_18 AC 8 ms
8,832 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 9 ms
8,832 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

let S = Array(readLine()!)
var (x,y) = (0,0)
for i in S{
    if i == "E"{x += 1}
    else if i == "W"{x -= 1}
    else if i == "N"{y += 1}
    else if i == "S"{y -= 1}
}
(x,y) = (abs(x),abs(y))
print(Double(x*x + y*y))
0