結果

問題 No.18 うーさー暗号
ユーザー yozayoza
提出日時 2016-12-11 21:09:59
言語 Vim script
(v9.1)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 656 bytes
コンパイル時間 46 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 5,872 KB
最終ジャッジ日時 2023-09-21 12:34:17
合計ジャッジ時間 918 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,680 KB
testcase_01 AC 4 ms
5,688 KB
testcase_02 AC 5 ms
5,724 KB
testcase_03 AC 15 ms
5,804 KB
testcase_04 AC 8 ms
5,756 KB
testcase_05 AC 8 ms
5,752 KB
testcase_06 AC 11 ms
5,772 KB
testcase_07 AC 12 ms
5,744 KB
testcase_08 AC 13 ms
5,836 KB
testcase_09 AC 12 ms
5,764 KB
testcase_10 AC 4 ms
5,684 KB
testcase_11 AC 4 ms
5,816 KB
testcase_12 AC 10 ms
5,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function! s:output()
  let this = {'lines': []}

  function! this.append(line) abort
    call add(self.lines, a:line)
  endfunction

  function! this.build() abort
    return join(self.lines, "\n")
  endfunction

  return this
endfunction

function! s:main(input) abort
  let o = s:output()

  let s = a:input[0]
  let r = []
  let offset = char2nr('A')
  for i in range(strlen(s))
    let ord = char2nr(s[i]) - offset
    let moved = (ord - i - 1 + 2600) % 26
    let chr = nr2char(moved + offset)
    call add(r, chr)
  endfor

  call o.append(join(r, ''))
  return o.build()
endfunction

let s:input = getline(1, '$')
enew
put =s:main(s:input)
2,$print
0