思维体操: HDU1287破译密码
破译密码
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 5372 Accepted Submission(s): 2509
30
17 6 9 8 3 0 1 6 7 4 5 10 11 8 9 14 15 12 13 18 19 16 17 22 23 20 21 26 27 24
SDKJABCDEFGHIJKLMNOPQRSTUVWXYZ
RunId : 21249667 Language : G++ Author : hnustwanghe
Code Render Status : Rendered By HDOJ G++ Code Render Version 0.01 Beta
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int N = 1000 + 5;
int a[N];
int main(){
int n,x,i;
while(scanf("%d",&n)==1){
bool flag = 0;
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
for(x ='A';x <= 'Z';x++){
for(flag=1,i=0;i<n;i++){
if(((a[i]^x) >'Z')||((a[i]^x)<'A')){
flag = 0;
break;
}
}
if(flag) break;
}
for(int i=0;i<n;i++)
printf("%c",a[i]^x);
printf("\n");
}
return 0 ;
}
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int N = 1000 + 5;
int a[N];
int main(){
int n,x,i;
while(scanf("%d",&n)==1){
bool flag = 0;
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
for(x ='A';x <= 'Z';x++){
for(flag=1,i=0;i<n;i++){
if(((a[i]^x) >'Z')||((a[i]^x)<'A')){
flag = 0;
break;
}
}
if(flag) break;
}
for(int i=0;i<n;i++)
printf("%c",a[i]^x);
printf("\n");
}
return 0 ;
}
思维体操: HDU1287破译密码的更多相关文章
- hdu1287 破译密码
题意: 破译密码 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
- 思维体操: HDU1049Climbing Worm
Climbing Worm Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- 思维体操: HDU1008 Elevator
Elevator Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total S ...
- 思维体操: HDU1022Train Problem I
Train Problem I Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- 2.Web开发过程流程图
转自:https://blog.csdn.net/hello_simon/article/details/19993343 最近公司在进行一系列新模块的开发,在痛苦开发的过程中,大家不时在一起进行总结 ...
- 题解-Koishi Loves Construction
题解-Koishi Loves Construction 前缀知识 质数 逆元 暴搜 Koishi Loves Construction 给定 \(X\),\(T\) 组测试数据,每次给一个 \(n\ ...
- &&与||的优先级比较
&&与||的优先级比较类似于一种思维体操,更多的是造成矛盾,使得两者因为先后顺序的不同而造成的不同结果,当然有时候需要注意c语言中的短路运算. 方法1. 代码如下: 点击查看代码 #i ...
- [C#][算法] 用菜鸟的思维学习算法 -- 马桶排序、冒泡排序和快速排序
用菜鸟的思维学习算法 -- 马桶排序.冒泡排序和快速排序 [博主]反骨仔 [来源]http://www.cnblogs.com/liqingwen/p/4994261.html 目录 马桶排序(令人 ...
- Photoshop、Illustrator思维导图笔记
半年前学习Photoshop时记得的思维导图笔记,可能不是很全,常用的基本都记下了.
随机推荐
- SpringBoot与jackson.databind兼容报错问题
SpringBoot与jackson.databind兼容报错问题 ———————————————— 1.SpringBoot版本V2.0.0其依赖的jackson-databind版本为V2.9.4 ...
- 在postman中请求的接口有csrf怎么办
今天在写项目的时候,写了一个post接口,为了防止crsf攻击,config.defalut.js文件中加了如下代码: exports.security = { csrf: { ignoreJSON: ...
- Java多线程的创建方法
Java 线程类也是一个 object 类,它的实例都继承自java.lang.Thread 或其子类. 可以用如下方式用 java 中创建一个线程,执行该线程可以调用该线程的 start()方法: ...
- Luogu P2678 跳石头
题目链接:Click here Solution: 最小值最大,显然二分,二分出mid后贪心去除石头,判断m次内是否可行即可 Code: #include<bits/stdc++.h> # ...
- codevs 1255 搭积木 x
1255 搭积木 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 大师 Master 题目描述 Description 一种积木搭建方式,高为H的积木,最底层有M个积木,每一层的积木 ...
- linq/EF 使用技巧笔记
先上图 1.linq列转行(如图从上到下,action_type即power字段),其实严格意义上来说,并不是linq,只是用了循环 List<NavigationDto> leaf = ...
- pyCharm报错"your evaluation license has expired, pycharm will now exit"解决方法(实测)
一.修改C:\Windows\System32\drivers\etc 目录下的hosts文件 1.打开hosts文件,路径是 c:\windows\system32\drivers\etc\host ...
- join的源码
long base = System.currentTimeMills(); long now = 0; if(millis < 0){ throw new IllegalArgumentE ...
- JavaScript 事件不触发
在class上绑定的事件,点击图片的时候无法触发 <div id="files" class="files"> <div> <p& ...
- 【洛谷T89353 【BIO】RGB三角形】
题目链接 这个题我一开始显然直接暴力 然后30分(但是应用数据分治的我通过复杂度判断并且其余输出0的能力硬生生的拿下了60分) 主要还是讲正解 这里有一个结论 这样一个图,红点的值可以通过两个黄点来判 ...