結果

問題 No.18 うーさー暗号
ユーザー itezpace
提出日時 2016-08-16 19:55:01
言語 Java
(openjdk 23)
結果
AC  
実行時間 88 ms / 5,000 ms
コード長 697 bytes
コンパイル時間 2,121 ms
コンパイル使用メモリ 74,776 KB
実行使用メモリ 37,712 KB
最終ジャッジ日時 2024-07-07 06:14:00
合計ジャッジ時間 3,225 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.lang.*;
import java.io.*;

class Yuki18 {
  public static void main(String[] args) throws IOException {
    DataInputStream d=new DataInputStream(System.in);
    String s;
    s=d.readLine();
    int ss;
    ss=s.length();
    for(int i=0; i<ss; ++i){
      char c;
      c=s.charAt(i);
      int a;
      a=c-'0';
      a-=(1+i);
      if(a<17){
        int b;
        if(a<0){
          b=a;
          b-=17;
          b*=-1;
        } else {
          b=17-a;
        }
        b%=26;
        if(b==0){
          a=17;
        } else {
          a=43-b;
        }
      }
      char c2;
      c2=(char)('A'+(a-17));
      System.out.print(c2);
    }
    System.out.println();
  }
}
0