結果

問題 No.18 うーさー暗号
ユーザー nullzinenullzine
提出日時 2017-01-11 16:20:12
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 960 bytes
コンパイル時間 2,851 ms
コンパイル使用メモリ 73,560 KB
実行使用メモリ 58,564 KB
最終ジャッジ日時 2023-08-23 08:29:10
合計ジャッジ時間 5,447 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,000 KB
testcase_01 AC 115 ms
56,624 KB
testcase_02 AC 115 ms
55,804 KB
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 * Created by nullzine on 2017/01/11.
 */
public class Main {

    public static void main(String[] args){
        System.out.println(new Main().decode(new java.util.Scanner(System.in).nextLine()));
    }

    private String decode(String str){
        StringBuilder ret = new StringBuilder();
        int offset=0;
        for(int i=0;i<str.toCharArray().length;i++){
            if((char)(str.charAt(i)-(i+1)+offset*26)=='@'){
                offset++;
            }
            ret.append((char)(str.charAt(i)-(i+1)+offset*26));
        }
        return ret.toString();
    }

    private String encode(String str){
        StringBuilder ret = new StringBuilder();
        int offset=0;
        for(int i=0;i<str.toCharArray().length;i++){
            if((char)(str.charAt(i)+(i+1)-offset*26)=='['){
                offset++;
            }
            ret.append((char)(str.charAt(i)+(i+1)-offset*26));
        }
        return ret.toString();
    }

}
0