結果

問題 No.18 うーさー暗号
ユーザー itezpaceitezpace
提出日時 2016-08-16 19:55:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 93 ms / 5,000 ms
コード長 697 bytes
コンパイル時間 2,052 ms
コンパイル使用メモリ 71,564 KB
実行使用メモリ 51,064 KB
最終ジャッジ日時 2023-09-21 12:23:57
合計ジャッジ時間 3,772 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
48,864 KB
testcase_01 AC 45 ms
48,768 KB
testcase_02 AC 48 ms
49,048 KB
testcase_03 AC 93 ms
50,856 KB
testcase_04 AC 60 ms
49,352 KB
testcase_05 AC 58 ms
49,204 KB
testcase_06 AC 76 ms
51,064 KB
testcase_07 AC 77 ms
50,888 KB
testcase_08 AC 91 ms
50,844 KB
testcase_09 AC 86 ms
51,008 KB
testcase_10 AC 45 ms
49,216 KB
testcase_11 AC 46 ms
47,320 KB
testcase_12 AC 67 ms
49,696 KB
権限があれば一括ダウンロードができます

ソースコード

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