题目1485:W's Cipher
来源:互联网 发布:离散数学 编程 编辑:程序博客网 时间:2024/04/30 08:41
#include<cstdio>#include<cstring>#include<algorithm>#include<queue>#include<stack>#include<iostream>#include<cmath> using namespace std;typedef long long LL; const int maxn=300;char s[maxn],ans[maxn];int k1,k2,k3,num1[maxn],num2[maxn],num3[maxn],p1,p2,p3; int main(){ //freopen("D:\\input.txt","r",stdin); while(scanf("%d%d%d",&k1,&k2,&k3)!=EOF) { if(k1==0&&k2==0&&k3==0) break; scanf("%s",s);p1=p2=p3=0; int len=strlen(s); for(int i=0;i<len;i++) { if(s[i]>='a'&&s[i]<='i') num1[p1++]=i; else if(s[i]>='j'&&s[i]<='r') num2[p2++]=i; else num3[p3++]=i; } for(int i=0;i<p1;i++) ans[num1[(i+k1)%p1]]=s[num1[i]]; for(int i=0;i<p2;i++) ans[num2[(i+k2)%p2]]=s[num2[i]]; for(int i=0;i<p3;i++) ans[num3[(i+k3)%p3]]=s[num3[i]]; /* for(int j=p1-k1,i=0;j<=p1-1;j++,i++) { ans[num1[i]]=s[num1[j]]; } for(int i=k1,j=0;i<p1;i++,j++) { ans[num1[i]]=s[num1[j]]; } for(int j=p2-k2,i=0;j<=p2-1;j++,i++) { ans[num2[i]]=s[num2[j]]; } for(int i=k2,j=0;i<p2;i++,j++) { ans[num2[i]]=s[num2[j]]; } for(int j=p3-k3,i=0;j<=p3-1;j++,i++) { ans[num3[i]]=s[num3[j]]; } for(int i=k3,j=0;i<p3;i++,j++) { ans[num3[i]]=s[num3[j]]; }*/ ans[len]='\0'; printf("%s\n",ans); } return 0;} /************************************************************** Problem: 1485 User: cust123 Language: C++ Result: Accepted Time:0 ms Memory:1524 kb****************************************************************/
0 0
- 题目1485:W's Cipher
- 题目1485:W's Cipher
- 【九度】题目1485:W's Cipher
- 九度题目1485:W's Cipher
- 九度oj 题目1485:W's Cipher
- 1042 W's Cipher
- POJ1107 W's Cipher
- ZOJ1042-W`s Cipher
- ZJU1042-W‘s Cipher
- poj 1107 --W's Cipher
- poj 1107W's Cipher
- zoj 1042 W's Cipher
- POJ1107 W's Cipher 【水题】
- zoj 1042 W's Cipher
- POJ 1107 W's Cipher
- ZOJ 1042 W's cipher
- POJ 1107 W's Cipher
- poj 1107 (jobdu 1485) W's Cipher AC代码
- java 继承
- 停止使用域名 boypay.net
- Pandas Series操作
- python多线程总结
- Nginx + Tomcat 配置负载均衡集群
- 题目1485:W's Cipher
- ubuntu14.04下安装dpdk及运行
- PowerDesigner学习笔记
- nyoj~123 士兵杀敌(四)(树状数组)
- 中矿投 — 全球闽籍珠宝工商总会常务副会长单位 应邀参加全球闽籍珠宝工商总会山东分会成立大会
- C#关键字之internal详解
- halcon/mfc利用serialport类制作串口通信对话框
- Fill-rate, Canvases and input
- Android Transition动画进入退出动画无效或重叠