ZOJ1006 Do the Untwist
简单模拟~
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+;
int a[maxn];
unordered_map<char,int> pos;
string s="_abcdefghijklmnopqrstuvwxyz.";
int len;
char ch[maxn];
int main () {
for (int i=;i<;i++)pos[s[i]]=i;
int n;
while (scanf("%d",&n)&&n) {
scanf("%s",ch);
len=strlen(ch);
for (int i=;i<len;i++) a[n*i%len]=(pos[ch[i]]+i)%;
for (int i=;i<len;i++) printf ("%c",s[a[i]]);
printf ("\n");
}
return ;
}
ZOJ1006 Do the Untwist的更多相关文章
- 1006 Do the Untwist
考察编程基础知识,用到字符和数字相互转化等.形式是描述清楚明文和暗文的转化规则. #include <stdio.h> #include <string.h> #define ...
- ZOJ 1006:Do the Untwist(模拟)
Do the Untwist Time Limit: 2 Seconds Memory Limit: 65536 KB Cryptography deals with methods of ...
- Do the Untwist(模拟)
ZOJ Problem Set - 1006 Do the Untwist Time Limit: 2 Seconds Memory Limit: 65536 KB Cryptography ...
- Do the Untwist
Do the Untwist Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- ZOJ Problem Set - 1006 Do the Untwist
今天在ZOJ上做了道很简单的题目是关于加密解密问题的,此题的关键点就在于求余的逆运算: 比如假设都是正整数 A=(B-C)%D 则 B - C = D*n + A 其中 A < D 移项 B = ...
- [ZOJ 1006] Do the Untwist (模拟实现解密)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=6 题目大意:给你加密方式,请你求出解密. 直接逆运算搞,用到同余定理 ...
- ACM/ICPC ZOJ1006-Do the Untwist 解题代码
#include <iostream> #include <string> #include <stdlib.h> using namespace std; int ...
- 杭电ACM分类
杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...
- OJ题目分类
POJ题目分类 | POJ题目分类 | HDU题目分类 | ZOJ题目分类 | SOJ题目分类 | HOJ题目分类 | FOJ题目分类 | 模拟题: POJ1006 POJ1008 POJ1013 P ...
随机推荐
- C语言 puts
C语言 puts #include <stdio.h> int puts(const char *s); 功能:标准设备输出s字符串,在输出完成后自动输出一个'\n'. 参数: s:字符串 ...
- Documents
centos 7 修改主机名 hostnamectl set-hostname myhostname ansible node -m raw -a "if [[ \$(cat /root/. ...
- react+ant design Breadcrumb面包屑组件
import React from 'react'; import { Link }from 'react-router-dom'; import { Breadcrumb } from 'antd' ...
- 【转载】Win7下如何使用GCC编译器
转自:http://jingyan.baidu.com/article/c275f6bacc0126e33c756771.html 双击GCC安装包,mingw-get-setup.exe,点击Ins ...
- ASP.NET/C# Razor视图引擎深入浅出
在ASPX中我们使用 <% %>在里面编写C#代码在Razor中我们将会使用@{}编写C#代码1.基础——@+属性显示计算1+2的值:<span>1+2=@(1+2)</ ...
- 计算几何-RC-poj2187
This article is made by Jason-Cow.Welcome to reprint.But please post the article's address. 今天学习一下旋( ...
- Mongodb学习笔记(三)性能篇
一.索引管理 MongoDB提供了多样性的索引支持,索引信息被保存在system.indexes中MongoDB中_id字段在创建的时候,默认已经建立了索引,这个索引比较特殊,并且不可以删除,不过Ca ...
- 【安卓逆向】反编译ELF的另类技巧
IDA 反编译 ObjDump反编译 ObjDump是ndk环境自带的一个脚本,在android-ndk-r10c/toolchains/arm-linux-androideabi-4.9/prebu ...
- python eval() 进行条件匹配
最近开发一个功能,根据条件表达式过滤数据,其中用到了eval(条件字符串,字典) 发现一个现象: >>> print u"campGrade in [ '\u51cf\u8 ...
- vue+vuex项目中怎么实现input模糊查询
1,首先给input框添加方法,但是用的是element-ui的组件,对input进行了封装,不能直接用原生的方法!,在element组件中,input框中方法有实例参数$event,代表事件对象 ...