結果
問題 | No.18 うーさー暗号 |
ユーザー |
![]() |
提出日時 | 2015-03-26 13:39:18 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 556 bytes |
コンパイル時間 | 9,069 ms |
コンパイル使用メモリ | 233,492 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 05:36:59 |
合計ジャッジ時間 | 9,585 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
ソースコード
package mainimport ("bufio""fmt""os")func main() {S := nextLine()fmt.Println(woosarCipher(S))}func woosarCipher(plain string) string {cipher := make([]rune, len(plain))for i, c := range plain {cipher[i] = rotate(c, i+1)}return string(cipher)}func rotate(c rune, n int) rune {ret := c - rune(n%26)if ret < 'A' {return ret + 26} else {return ret}}var sc = bufio.NewScanner(os.Stdin)func nextLine() string {sc.Split(bufio.ScanLines)sc.Scan()if nil != sc.Err() {panic(sc.Err())}return sc.Text()}