nefu 1116 字符串加密
字符串加密 |
|||
|
|||
description |
|||
给你一段经过加密的字符串,我们称之为密文,现在请你编写程序输出它加密前的字符串(原文)。 |
|||
input |
|||
多组输入数据,每组数据只有一个加密后的字符串。长度不超过1000000,只包含数字字符和小写字母,其中连续数字的长度不超过9,最后一位一定是小写字母。 |
|||
output |
|||
输出一行原字符串。 |
|||
sample_input |
|||
happynewyear |
|||
sample_output |
|||
happynewyear |
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
using namespace std;
char *ch="abcdefghijklmnopqrstuvwxyz";
char a[];
int main()
{
int i,k,j,shu,tmp,cou;
while(scanf("%s",a)!=-)
{
for(i=;a[i]!='\0';)
{
k=;shu=;j=;
while(a[i]>=''&&a[i]<='')
{
k++;
i++;
}//此时的i是那个字母
if(k)
{
for(cou=;cou<=k;cou++)
{
shu=shu+(((int)a[i-cou]-)*j);
j=j*;
}
tmp=(a[i]-+shu)%;
printf("%c",ch[tmp]);
}
else cout<<a[i];
i++;
}
cout<<endl;
}
return ;
}
//while。。很有趣。。。
//下面是之前超时的代码
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
using namespace std;
char *ch="abcdefghijklmnopqrstuvwxyz";
char a[];
int main()
{
int k,shu,tmp,i;
while(scanf("%s",a)!=-)
{
for(i=;i<strlen(a);i++)
{
if(a[i]<='z'&&a[i]>='a')
{
if(a[i-]>''||a[i-]<'')
printf("%c",a[i]);
else
{
shu=(int)a[i-]-;
if(a[i-]<=''&&a[i-]>='')
shu=shu+((int)a[i-]-)*;
tmp=(a[i]-+shu)%;
printf("%c",ch[tmp]);
}
}
}
cout<<endl;
} return ;
}
nefu 1116 字符串加密的更多相关文章
- 利用javascript对字符串加密
没事利用js写个对字符串加密的方法,基本原理就是先把字符串转化成对应的unicode(用到的方法是charCodeAt()),再把unicode统一减去100(这里加减随便你取多少),把得到的unic ...
- iOS字符串加密至MD5&及获取文件MD5
iOS 字符串加密至MD5 #import <CommonCrypto/CommonDigest.h> + (NSString *) md5:(NSString *)str { const ...
- Labview实现字符串加密
Labview实现字符串加密 对字符串进行加密,规则是每个字母后移5 位 例如A 变为F,b 变为g,x 变为c,y 变为d- 实现效果 后端实现
- Dotfuscator可以实现混淆代码、变量名修改、字符串加密
C#编写的代码如果不进行一定程度的混淆和加密,那么是非常容易被反编译进行破解的,特别是对于一些商业用途的C#软件来说,因为盯着的人多,更是极易被攻破.使用VS自带的Dotfuscator可以实现混淆代 ...
- C# 字符串加密解密方法
这个是加密的算法的命名空间,使用加密算法前要引用该程序集 System.Security.Cryptography using System;using System.Data;using Syst ...
- 敏感字符串加密处理(PHP实现)
/** * 敏感字符串加密处理 * @param $raw_str 原始字符串 * @param $before 前面保留的显示位数 * @param $after 后面保留的显示位数 * @para ...
- C# 字符串加密解密函数
原文:C# 字符串加密解密函数 using System; using System.Text;using System.Security.Cryptography; using System.IO; ...
- Java对字符串加密并返回星号※
If you don't look back, you'll never know I waiting for you behind you. Java对字符串加密并返回星号※ PasswordUt ...
- 从网上整理的一些delphi字符串加密解密方法
function Encode(Str: string): string; var //加密 TmpChr: AnsiChar; i, Len: integer; begin Result := St ...
随机推荐
- File对象的常用方法
File对象不仅可以表示文件,还可以表示目录,源码注释是这么说的:An abstract representation of file and directory pathnames. File类最常 ...
- Unity5权威讲解
Photon Cloud 299c7416-a08d-4a23-95a1-e4be108259aa Shooter 视频:https://pan.baidu.com/s/1kVFJ1x9 项目:htt ...
- java.util.Timer类似于闹钟定时做任务
在web中实现任务计划,相当于实现闹钟的功能,要完成2个步骤: 1.定时器的设置: 2.对这个定时器的启动运行和停止进行实时监听 java.util.Timer定时器,实际上是个线程,定时调度所拥有的 ...
- 【.NET】上传文件,生成缩略图
类名:Upload using System; using System.Collections; using System.ComponentModel; using System.Data; us ...
- selenium中的webdriver定位元素失败的常见原因
自动化测试中经常会出现无法定位元素的情况,报selenium.common.exceptions.NoSuchElementException错误 Frame/Iframe原因定位不到元素: 这个是最 ...
- mac地址和ip地址要同时存在么?
刚再整理笔记的时候,突然想到了一个问题,网络中为什么要同时存在mac地址和ip地址呢?那现在就来随便扯扯吧. 这个问题其实是可以分成两个问题的:Q1:如果只有mac地址,没有ip地址可以么? 众所周知 ...
- 计算机网络课程优秀备考PPT之第三章数据链路层(三)
为了记录自己从2016.9~2017.1的<计算机网络>助教生涯,也为了及时梳理和整写笔记! 前期博客是, 计算机网络课程优秀备考PPT之第一章概述(一) 计算机网络课程优秀备考PPT之第 ...
- shell脚本学习(五)
1.统计文件的行数.单词数.字符数 1)行数: wc -l file cat file | wc -l 2)单词数 wc -w file cat file | wc -w 3)统计字符数 wc -c ...
- JVM基础(5)-垃圾回收机制
一.对象引用的类型 Java 中的垃圾回收一般是在 Java 堆中进行,因为堆中几乎存放了 Java 中所有的对象实例.谈到 Java 堆中的垃圾回收,自然要谈到引用.在 JDK1.2 之前,Java ...
- LeetCode OJ 31. Next Permutation
Implement next permutation, which rearranges numbers into the lexicographically next greater permuta ...