結果

問題 No.18 うーさー暗号
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-06 23:12:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 662 bytes
コンパイル時間 3,668 ms
コンパイル使用メモリ 71,988 KB
実行使用メモリ 55,936 KB
最終ジャッジ日時 2023-09-21 12:19:58
合計ジャッジ時間 5,818 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
53,568 KB
testcase_01 AC 124 ms
55,500 KB
testcase_02 AC 124 ms
55,636 KB
testcase_03 AC 129 ms
55,628 KB
testcase_04 AC 128 ms
55,608 KB
testcase_05 AC 129 ms
55,784 KB
testcase_06 AC 127 ms
55,340 KB
testcase_07 AC 127 ms
55,936 KB
testcase_08 AC 127 ms
55,888 KB
testcase_09 AC 125 ms
55,576 KB
testcase_10 AC 123 ms
55,596 KB
testcase_11 AC 124 ms
55,536 KB
testcase_12 AC 127 ms
55,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise65{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    String str = sc.next();

    char[] strArray = str.toCharArray();
    char[] newStrArray = new char[strArray.length];

    for (int i = 0; i < strArray.length; i++){
      int num = (int)strArray[i];
      num -= (i + 1);
      num = getNum(num);
      newStrArray[i] = (char)num;
    }

    String newStr = String.valueOf(newStrArray);
    System.out.println(newStr);
  }

  private static int getNum(int num){
    if (num < 65){
      num = 90 - (64 - num);
      return getNum(num);
    }else{
      return num;
    }
  }
}
0