hdu2672
来源:互联网 发布:安装ubuntu u盘 编辑:程序博客网 时间:2024/06/05 15:32
god is a girl
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1491 Accepted Submission(s): 697
I really wanted to talked to her,but my English was so poor and she was not a national god but a foreign one...After thirty minutes,she flew away...but story was not finished here,she had left a letter for me!!!What puzzled me so much is the letter was encoded.I had thought for many days,but still can't get it. Now I turn to you for help,with some limited prompts,can you help me to decode the whole letter?
Prompts:
GDJIJ,EL SSJT UT YWOSQNIVZMI. -> HELLO,MY NAME IS LINDAINVERS.
CN WLP JRVMFGQ BVR,IJCFI? -> DO YOU REQUIRE AID,HUMAN?
NMAB VYNNF, FI'E VC HP IXJ ZLQZI. -> ONCE AGAIN, IT'S UP TO THE ELVES.
...
Each case is one line of string with uppercase letters and white spaces and other symbols.
SGC CGGJX GC BMHVQ BGU BCIHNYNBX GNPLV!
THE FLOWS OF MAGIC ARE WHIMSICAL TODAY!
AC代码:
#include <iostream>#include <cstdio>#include<algorithm>#include<cstring>using namespace std;int a[10005];void calc()//打表计算斐波那契数列{ a[1] = a[2] = 1; for(int i = 3; i < 10005; i++) { a[i] = a[i-1] + a[i-2]; while(a[i] > 26)//字母序以26为周期 a[i] -= 26; }}int main(){ calc(); char c; int i = 1; while( ~scanf("%c", &c) ) { if(c == '\n') i = 1; if( c > 64 && c < 92 ) { c += a[i];//对字母字符进行解码 while( c >= 91 ) c -= 26;//如果超出字母范围,则减一个周期(26) i++; } cout<<c; } return 0;}
- hdu2672
- hdu2672
- Java多线程中Lock的实现
- QTcpServer / QTcpSocket 简单示例
- jQuery中的属性选择器
- Keepalived主从虚拟路由器_虚拟服务器_优先级调整
- map&set学习总结
- hdu2672
- HBase调优小结
- 正确建立索引以及最左前缀原则
- android 怎么代码控制 drawableTop
- 低版本的IE7和IE8对overflow: hidden;的兼容性处理办法
- NoReverseMatch at /blog/ Reverse for 'blog.views.blogpost' not found. 'blog.views.blogpost' is not a
- android控件10---ToolBar
- ROS导航小车无故倒退问题分析
- ffmpeg的命令