結果

問題 No.18 うーさー暗号
ユーザー MaboyMaboy
提出日時 2021-05-30 00:02:46
言語 Swift
(5.10.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 300 bytes
コンパイル時間 10,624 ms
コンパイル使用メモリ 118,464 KB
実行使用メモリ 7,672 KB
最終ジャッジ日時 2023-08-08 08:09:42
合計ジャッジ時間 11,933 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,560 KB
testcase_01 AC 3 ms
7,652 KB
testcase_02 AC 3 ms
7,612 KB
testcase_03 AC 3 ms
7,608 KB
testcase_04 AC 4 ms
7,628 KB
testcase_05 AC 3 ms
7,592 KB
testcase_06 AC 3 ms
7,552 KB
testcase_07 AC 4 ms
7,636 KB
testcase_08 AC 4 ms
7,672 KB
testcase_09 AC 4 ms
7,624 KB
testcase_10 AC 3 ms
7,372 KB
testcase_11 AC 3 ms
7,588 KB
testcase_12 AC 3 ms
7,600 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.swift:3:9: warning: variable 'code' was never mutated; consider changing to 'let' constant
    var code = String(str).unicodeScalars.first!.value
    ~~~ ^
    let

ソースコード

diff #

let strArray = readLine()!.map{$0}
for (i,str) in strArray.enumerated(){
    var code = String(str).unicodeScalars.first!.value
    var usa = Int(code) - (i+1) % 26
    if usa < 65{
        usa = usa + 26
    }
    let chrStr = Character(UnicodeScalar(usa)!)
    print(chrStr,terminator:"")
}
print()
0