結果
| 問題 | No.18 うーさー暗号 |
| コンテスト | |
| ユーザー |
r.suzuki
|
| 提出日時 | 2016-01-24 03:29:14 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 113 ms / 5,000 ms |
| コード長 | 893 bytes |
| コンパイル時間 | 2,921 ms |
| コンパイル使用メモリ | 77,764 KB |
| 実行使用メモリ | 53,992 KB |
| 最終ジャッジ日時 | 2024-07-07 05:57:35 |
| 合計ジャッジ時間 | 4,692 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
interface Converter {
void encode();
void decode();
}
class U_SA_ implements Converter {
private final int firstNum = 65;
private final int lastNum = 90;
private char[] code;
public U_SA_(String s) {
this.code = s.toCharArray();
}
public void encode() {
}
public void decode() {
int num;
for (int i = 0; i < code.length; i++) {
num = (i + 1) % 26;
code[i] = decode2(code[i], num);
}
}
public char decode2(char c, int num) {
if ((c - num) >= firstNum) {
c -= num;
return c;
} else {
c = (char) (lastNum - (firstNum - (c - num)) + 1);
return c;
}
}
public void printCode() {
System.out.println(this.code);
}
}
public class No_18 {
public static void main(String[] args) {
java.util.Scanner sc = new java.util.Scanner(System.in);
U_SA_ u_sa_ = new U_SA_(sc.next());
u_sa_.decode();
u_sa_.printCode();
sc.close();
}
}
r.suzuki