您的位置:首页 > 其它

hdu 1287破译密码(水)

2011-09-01 19:31 211 查看
/*
2011-9-1
author:BearFly1990
*/
package acm.hdu.tests;

import java.io.BufferedInputStream;
import java.util.Scanner;

public class HDU_1287 {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedInputStream(System.in));
int n;
while( in.hasNext()){
n = in.nextInt();
int[] a = new int
;
int[] word = new int
;

for(int i = 0; i < n; i++){
a[i] = in.nextInt();
}

for(int j = 'A'; j <='Z'; j++){
boolean isKey = true;
for(int i = 0; i < n; i++){
word[i] = j^a[i];
if(word[i] < 'A' || word[i] > 'Z'){
isKey = false;
break;
}
}
//System.out.println(isKey);
if(isKey){
for(int i = 0; i < n; i++){
System.out.print((char)word[i]);
}
System.out.println();
}
}
}
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: