OpenJudgeP1.7.10:简单密码__(刷题)_水题

因为本人很懒,不想去找什么,ASCII码的规律......

就又开了一个cpp,打了一份if&else 的表。

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 char a[50];
 4 char b[50];
 5
 6 /*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
 7 V W X Y Z A B C D E F G H I J K L M N O P Q R S T U*/
 8
 9 int main()
10 {
11     for(int i=1;i<=26;i++) cin>>a[i];
12     for(int i=1;i<=26;i++) cin>>b[i];
13     for(int i=1;i<=26;i++) cout<<a[i];
14     for(int i=1;i<=26;i++) cout<<b[i];
15     for(int i=0;i<=26;i++)
16         printf("else if(ch[i] == ‘%c‘) ans[i]=‘%c‘;\n",a[i],b[i]);
17     return 0;
18 }

Ctrl+C && Tab一下就完成了!!!

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 const int maxn=1e6 + 5;
 4 char ch[maxn],ans[maxn];
 5 int main()
 6 {
 7     while(scanf("%s",ch)!=EOF)
 8     {
 9         int len=strlen(ch);
10         for(int i=0;i<len;i++)
11         {
12             if(‘A‘<=ch[i] && ch[i]<=‘Z‘)
13             {
14                 if(ch[i] == ‘A‘) ans[i]=‘V‘;
15                 else if(ch[i] == ‘B‘) ans[i]=‘W‘;
16                 else if(ch[i] == ‘C‘) ans[i]=‘X‘;
17                 else if(ch[i] == ‘D‘) ans[i]=‘Y‘;
18                 else if(ch[i] == ‘E‘) ans[i]=‘Z‘;
19                 else if(ch[i] == ‘F‘) ans[i]=‘A‘;
20                 else if(ch[i] == ‘G‘) ans[i]=‘B‘;
21                 else if(ch[i] == ‘H‘) ans[i]=‘C‘;
22                 else if(ch[i] == ‘I‘) ans[i]=‘D‘;
23                 else if(ch[i] == ‘J‘) ans[i]=‘E‘;
24                 else if(ch[i] == ‘K‘) ans[i]=‘F‘;
25                 else if(ch[i] == ‘L‘) ans[i]=‘G‘;
26                 else if(ch[i] == ‘M‘) ans[i]=‘H‘;
27                 else if(ch[i] == ‘N‘) ans[i]=‘I‘;
28                 else if(ch[i] == ‘O‘) ans[i]=‘J‘;
29                 else if(ch[i] == ‘P‘) ans[i]=‘K‘;
30                 else if(ch[i] == ‘Q‘) ans[i]=‘L‘;
31                 else if(ch[i] == ‘R‘) ans[i]=‘M‘;
32                 else if(ch[i] == ‘S‘) ans[i]=‘N‘;
33                 else if(ch[i] == ‘T‘) ans[i]=‘O‘;
34                 else if(ch[i] == ‘U‘) ans[i]=‘P‘;
35                 else if(ch[i] == ‘V‘) ans[i]=‘Q‘;
36                 else if(ch[i] == ‘W‘) ans[i]=‘R‘;
37                 else if(ch[i] == ‘X‘) ans[i]=‘S‘;
38                 else if(ch[i] == ‘Y‘) ans[i]=‘T‘;
39                 else if(ch[i] == ‘Z‘) ans[i]=‘U‘;
40             }
41             else ans[i]=ch[i];
42         }
43         for(int i=0;i<len;i++) printf("%c",ans[i]);
44         printf(" ");
45     }
46     return 0;
47 }

原文地址:https://www.cnblogs.com/pengcheng-official/p/9459607.html

时间: 2024-10-04 09:11:34

OpenJudgeP1.7.10:简单密码__(刷题)_水题的相关文章

涨姿势题2_水题_两种解法

Problem Description 涨姿势题就是所谓的优化题,在组队赛中,队伍发现了一题水题,那么应该交给谁去处理?作为处理水题的代码手,应该具备什么样的素养?1,要快,水题拼的就是速度!2,不能卡水题!水题都卡,绝对不是一个代码手的风范!3,不能出错,错一次即罚时20分钟,对于水题来讲是致命的!4,要能看出来一题是水题!没有这条,上面三条都是没有意义的! 如果你希望你成团队中一个合格的代码手,那么这套题是你最好的选择,快AC吧! 本系列即是为了提高水题代码手的素养而准备的!水题经常需要用到

sdut 2413:n a^o7 !(第三届山东省省赛原题,水题,字符串处理)

n a^o7 ! Time Limit: 1000MS Memory limit: 65536K 题目描述 All brave and intelligent fighters, next you will step into a distinctive battleground which is full of sweet and happiness. If you want to win the battle, you must do warm-up according to my inst

HDU5742 It&#39;s All In The Mind(思维题,水题)

Problem Description Professor Zhang has a number sequence a1,a2,...,an. However, the sequence is not complete and some elements are missing. Fortunately, Professor Zhang remembers some properties of the sequence: 1. For every i∈{1,2,...,n}, 0≤ai≤100.

致我们曾经刷过的水题

ummmm...8年级的同学来gryz参加夏令营了.感觉自己老得好快...在此整理一下本人刷过的那些道水题...希望以后能有什么用吧(怎么可能233333). 统计: Openjudge: 累计153题. CodeVS: 累计64题. 洛谷: 累计111题. COGS: 累计5题. 去重前累计333题. ......待续......

HDU 1019 Least Common Multiple (最小公倍数_水题)

Problem Description The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105. Input Input will consist of multiple prob

课后题 3-3 水题

Digit Counting Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu Submit Status Description Download as PDF Trung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequence of consecutive integ

HDU2076 夹角有多大(题目已修改,注意读题)【水题】【计算几何】

夹角有多大(题目已修改,注意读题) Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10194    Accepted Submission(s): 4072 Problem Description 时间过的好快,一个学期就这么的过去了,xhd在傻傻的看着表,出于对数据的渴望,突然他想知道这个表的时针和分针的夹角是多少.现在xhd知道的

F题(水题)

给出一个有N个数的序列,编号0 - N - 1.进行Q次查询,查询编号i至j的所有数中,最大的数是多少. 例如: 1 7 6 3 1.i = 1, j = 3,对应的数为7 6 3,最大的数为7.(该问题也被称为RMQ问题) Input第1行:1个数N,表示序列的长度.(2 <= N <= 10000) 第2 - N + 1行:每行1个数,对应序列中的元素.(0 <= Sii <= 10^9) 第N + 2行:1个数Q,表示查询的数量.(2 <= Q <= 10000)

HDU 5744 Keep On Movin (思维题,水题)

Problem Description Professor Zhang has kinds of characters and the quantity of the i-th character is ai. Professor Zhang wants to use all the characters build several palindromic strings. He also wants to maximize the length of the shortest palindro