結果
問題 | No.18 うーさー暗号 |
ユーザー |
![]() |
提出日時 | 2015-04-30 18:28:11 |
言語 | Perl (5.40.0) |
結果 |
AC
|
実行時間 | 8 ms / 5,000 ms |
コード長 | 381 bytes |
コンパイル時間 | 135 ms |
コンパイル使用メモリ | 5,632 KB |
実行使用メモリ | 5,760 KB |
最終ジャッジ日時 | 2024-07-07 05:40:52 |
合計ジャッジ時間 | 1,014 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
#!/usr/bin/perl use strict; use warnings; my @array = ('A'..'Z'); my $s = <>; chomp $s; my @str = split //, $s; my $change; for(my $i = 0; $i <length $s; $i++) { my $j; for($j = 0; $j < 26; $j++) { if($str[$i] eq $array[$j]) { last; } } $change = $j - ($i % 26) - 1; if($change < 0) { $change += 26; } $str[$i] = $array[$change]; } print @str; print "\n"; exit;