POJ 2141 Message Decowding(简单题)

【题意简述】:这个题目描述非常简单,不再赘述。

【分析】:直接把那个输入的字符,当做是key值数组的下标即可。

//164K  16Ms
#include<iostream>
using namespace std;

char Key[27];
char decoded [81];

int main()
{
	gets(Key);
	gets(decoded);

	for(int i = 0;i<strlen(decoded);i++)
	{
		if(decoded[i]>='A'&&decoded[i]<='Z')
			cout<<char(Key[decoded[i]-'A']-'a'+'A');
		else if(decoded[i]>='a'&&decoded[i]<='z')
			cout<<Key[decoded[i]-'a'];
		else
			cout<<decoded[i];
	}
	return 0;
}
时间: 2024-08-02 15:14:01

POJ 2141 Message Decowding(简单题)的相关文章

OpenJudge / Poj 2141 Message Decowding

1.链接地址: http://poj.org/problem?id=2141 http://bailian.openjudge.cn/practice/2141/ 2.题目: Message Decowding Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11784   Accepted: 6562 Description The cows are thrilled because they've just learn

POJ 2141 Message Decowding(map)

Message Decowding Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11735   Accepted: 6536 Description The cows are thrilled because they've just learned about encrypting messages. They think they will be able to use secret messages to plo

POJ 2051 argus(简单题,堆排序or优先队列)

又是一道数据结构题,使用堆来进行权值调整和排序,每次调整都是o(n)的复杂度,非常高效. 第一眼看题觉得可以用优先队列来做,应该也很简单. 事实上多数优先队列都是通过堆来实现的. 写的时候还是出了一些问题: 1.二叉树根节点下标显然不能为0: 2.限界之后若出现扩界要小心: 3.在迭代循环比较的时候,尤其注意到底比较的是谁,别把自己绕晕了. ac代码: #include<iostream> #include<cstdio> #include<cstdlib> #incl

poj 1847 最短路简单题,dijkstra

1.poj  1847  Tram   最短路 2.总结:用dijkstra做的,算出a到其它各个点要改向的次数.其它应该也可以. 题意: 有点难懂.n个结点,每个点可通向ki个相邻点,默认指向第一个相邻点,可以改变指向.求一条从A到B的路,使用最少改变路上点的指向的次数. #include<iostream> #include<cstring> #include<cmath> #include<queue> #include<algorithm>

POJ 3619 Speed Reading(简单题)

[题意简述]:有K头牛,N页书,每次第i头牛每分钟只能读Si页书,连续读Ti分钟,之后休息Ri分钟.现在问我们第i头牛花费多少时间可以读完这N页书. [分析]:简单的模拟 //220K 32Ms #include<iostream> #include<cmath> using namespace std; int main() { double N,K,Si,Ti,Ri; cin>>N>>K; double a = N; for(int i = 0;i<

poj 2955 Brackets dp简单题

//poj 2955 //sep9 #include <iostream> using namespace std; char s[128]; int dp[128][128]; int n; int rec(int l,int r) { if(dp[l][r]!=-1) return dp[l][r]; if(l==r) return dp[l][r]=0; if(l+1==r){ if(s[l]=='('&&s[r]==')') return dp[l][r]=2; if(

POJ 2575 Jolly Jumpers(简单题)

[题意简述]:将数列中相邻的两个数做差,判断得到的绝对值是否是1,2,--,n-1,如果是的话,则是Jolly ,否则not jolly. [分析]:开始时没有仔细看题,没有看到时相邻的两个数做差,以为任意两两做差. 而后重新分析题目后,解决了这道题目,我们可以使用一个标志数组来帮助我们储存得到的做差的绝对值的值,最后,我们只需要扫描一下这个数组看是否从1,2,--,n-1都有值与之相对应. 详见代码: // 324K 47Ms #include<iostream> #include<c

POJ 3589 Number-guessing Game(简单题)

[题目简述]:两个四位数,假设后一个数中的某个数与前一个相应的数的位置和值都相等.则统计数目由几个这种数.记为count1吧. 假设后一个数中的某个数与前一个数的数值相等,但位置不同. 此时这种数的个数记为count2. 写成*A*B,即count1 A count2 B. [分析]:题目的简述即分析. //740K 0Ms #include<iostream> #include<cstring> using namespace std; int main() { int T; s

POJ 3299 Humidex(简单题)

[题意简述]:就是什么温度,湿度--,之间的转换.. [分析]:公式已给出了. // 252k 0Ms /* 其中exp表示的是求e的x次幂 解法就直接根据题目中的公式解决就好!! */ #include<iostream> #include<iomanip> #include<cmath> using namespace std; int main() { double t,d,h; char alpha; while(1) { t = d = h = 101; fo