1316: University

题目描述

在大学里,很多单词都是一词多义,偶尔在文章里还要用引申义。这困扰Redraiment很长的时间。
他开始搜集那些单词的所有意义。他发现了一些规律,例如
“a”能用“e”来代替, “c”能用“f”来代替……
现在他给出了字母的替换规则,如下所示,A被E替换,B被C替换,依次类推。
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
E C F A J K L B D G H I V W Z Y M N O P Q R S T U X
a b c d e f g h i j k l m n o p q r s t u v w x y z
e r w q t y g h b n u i o p s j k d l f a z x c v m

输入要求

本题包括多组测试数据。 每组测试数据为一行:为仅由字母和空格组成的字符串(空格不变)。 输入以单行“#”结束。

输出要求

对应每组测试数据,替换后输出它的引申义。

假如输入

Ilttabaje zaujljg
#

应当输出

Different meaning

#include<iostream>
#include<algorithm>
#include <vector>
#include<string.h>
#include<ctype.h>
using namespace std;
void fun();
char turn(char c)
{
	char result;
	if(c=='A')result='E';
	if(c=='B')result='C';
	if(c=='C')result='F';
	if(c=='D')result='A';
	if(c=='E')result='J';
	if(c=='F')result='K';
	if(c=='G')result='L';
	if(c=='H')result='B';
	if(c=='I')result='D';
	if(c=='J')result='G';
	if(c=='K')result='H';
	if(c=='L')result='I';
	if(c=='M')result='V';
	if(c=='N')result='W';
	if(c=='O')result='Z';
	if(c=='P')result='Y';
	if(c=='Q')result='M';
	if(c=='R')result='N';
	if(c=='S')result='O';
	if(c=='T')result='P';
	if(c=='U')result='Q';
	if(c=='V')result='R';
	if(c=='W')result='S';
	if(c=='X')result='T';
	if(c=='Y')result='U';
	if(c=='Z')result='X';

	if(c=='a')result='e';
	if(c=='b')result='r';
	if(c=='c')result='w';
	if(c=='d')result='q';
	if(c=='e')result='t';
	if(c=='f')result='y';
	if(c=='g')result='g';
	if(c=='h')result='h';
	if(c=='i')result='b';
	if(c=='j')result='n';
	if(c=='k')result='u';
	if(c=='l')result='i';
	if(c=='m')result='o';
	if(c=='n')result='p';
	if(c=='o')result='s';
	if(c=='p')result='j';
	if(c=='q')result='k';
	if(c=='r')result='d';
	if(c=='s')result='l';
	if(c=='t')result='f';
	if(c=='u')result='a';
	if(c=='v')result='z';
	if(c=='w')result='x';
	if(c=='x')result='c';
	if(c=='y')result='v';
	if(c=='z')result='m';
	return result;
}
int main()
{
	fun();
	return 0;
}
void fun()
{
	char str[1001],str0,str1;
	int arr[1001];
	int i;
	while(gets(str))
	{
		if(str[0]=='#')
			break;
		for(i=0;i<strlen(str);i++)
		{
			if(str[i]==' ')
				cout<<' ';
			else
				cout<<turn(str[i]);
		}
		cout<<endl;
	}
}
时间: 2024-10-10 04:38:08

1316: University的相关文章

HDOJ 1316 How Many Fibs?

JAVA大数.... How Many Fibs? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3906    Accepted Submission(s): 1545 Problem Description Recall the definition of the Fibonacci numbers: f1 := 1 f2 :=

hdu 1316 How many Fibs?(高精度斐波那契数)

//  大数继续 Problem Description Recall the definition of the Fibonacci numbers: f1 := 1 f2 := 2 fn := fn-1 + fn-2 (n >= 3) Given two numbers a and b, calculate how many Fibonacci numbers are in the range [a, b]. Input The input contains several test cas

HDU 1316 How Many Fibs? (大Fib数,还是Java大法好)

How Many Fibs? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5822    Accepted Submission(s): 2267 Problem Description Recall the definition of the Fibonacci numbers: f1 := 1 f2 := 2 fn := fn-

Poj 2010-Moo University - Financial Aid

Moo University - Financial Aid 题目链接:http://poj.org/problem?id=2010 Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 9046   Accepted: 2640 Description Bessie noted that although humans have many universities they can attend, cows have none

hdu 1316 How Many Fibs?

题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1316 How Many Fibs? Description Recall the definition of the Fibonacci numbers: $f_1 := 1$ $f_2 := 2$ $f_n := f_{n-1} + f_{n-2} \ \ (3 \leq n)$ Given two numbers a and b, calculate how many Fibonacci num

hdoj 1316 How Many Fibs? 【Java大数】+【打表】

现将前1000个的斐波那契数打表,然后再找就好了. 代码: import java.util.Scanner; import java.math.*; public class Main{ public static void main(String[] args){ Scanner cin = new Scanner(System.in); BigInteger[] s = new BigInteger[1005]; s[1] = new BigInteger("1"); s[2]

Autism Course of Yale University Fred Volkman 2

Yale University Speaker :Fred Volkman Yale Child Study Center http://open.163.com/special/opencourse/autism.html materials: <A Pracktical Guide to Autism> <Handbook of Autism> ASD Core Diagonostic Features catalog 1.Summary 2.social brain ----

hdu 1316 How Many Fibs? (模拟高精度)

题目大意: 问[s,e]之间有多少个 斐波那契数. 思路分析: 直接模拟高精度字符串的加法和大小的比较. 注意wa点再 s 可以从 0 开始 那么要在判断输入结束的时候注意一下. #include <cstdio> #include <iostream> #include <cstring> #include <algorithm> using namespace std; struct node { char str[111]; int len; void

POJ 1316 Self Numbers

题目链接: http://poj.org/problem?id=1316 Description In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d stands for digi