洛谷 1079 Vigenère 密码——模拟水题
2024-08-25 08:26:02
题目:https://www.luogu.org/problemnew/show/P1079
大水题。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=,M=;
int n,m;
char a[N],b[N];
int get_int(char ch)
{
if(ch>='A'&&ch<='Z') return ch-'A'+;
return ch-'a'+;
}
int main()
{
scanf("%s",a+); n=strlen(a+);
scanf("%s",b+); m=strlen(b+);
int j=;
for(int i=,d;i<=m;i++)
{
j++; if(j>n) j=;
d=get_int(b[i])+-get_int(a[j]);
if(d<=)d+=;
d+=(b[i]>='A'&&b[i]<='Z'?'A'-:'a'-);
printf("%c",d);
}
return ;
}
最新文章
- ASP.NET Core的配置(2):配置模型详解
- Elong App 性能测试分享
- [洛谷OJ] P1114 “非常男女”计划
- PHP系列之一traits的应用
- 做bbs论坛项目的收获(1)
- item2,实现singleton模式
- Telerik_2012_Q3 (已破解)全套下载链接
- hibernate联合主键注解配置
- UIImageView图片视图的基本概念和使用方法
- 如何在一个jpg图片上面叠加文字
- MyReport报表引擎2.1.0.0新功能
- WCF小实例以及三种宿主
- DPDK support for vhost-user
- 如何优雅地实现Python通用多线程/进程并行模块
- python基础——继承实现的原理
- linux上部署JMeter
- postgresql数据库安装及简单操作
- 小tip: transition与visibility
- 使用babel将ES6编译成ES5
- 编写前程贷投标loadrunner脚本及总结