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 ...
随机推荐
- EditPlus等编辑器选中列(块)的方法
EditPlus 1)菜单:编辑 -> 选择 -> 列选择2)先按下 Alt + C ,释放,然后移动鼠标或键盘上下左右键进行选择注意:在自动换行的模式下是不行的,改为不自动换行就行了. ...
- AcWing 792. 高精度减法
https://www.acwing.com/problem/content/794/ #include<bits/stdc++.h> using namespace std; //判断是 ...
- 题解【洛谷P1841】[JSOI2007]重要的城市
题面 题解 最短路图模板题. 介绍一下最短路图: 先对原图跑一边单源最短路,求出源点到每个点\(i\)的最短路\(dis[i]\). 接下来构建新图:对于一条边\((x,y,v)\),若\(dis[x ...
- Docker - 最近的踩到的一些坑
概述 最近学习 docker 遇到的 坑 1. dockerfile: 安装命令 概述 安装命令 坑 选项参数里, 一定要 带 -y 不带的话, 基本会阻塞构建 2. 其他: 处理问题, 一定不能慌 ...
- MySQL移动数据库位置
http://zlyang.blog.51cto.com/1196234/1726029 需求:MySQL数据库文件原位置:/var/lib/mysql 要移动至:/data/mysql 1.首先在/ ...
- EAC3 enhanced channel coupling
Enhanced channel coupling是一种spatial coding 技术,在传统的channel coupling的基础上添加了phase compensation, de-corr ...
- 《绘图前设置:像素格式——PIXELFORMATDESCRIPT、设备上下文、渲染上下文》
转载地址:https://www.cnblogs.com/wiener-zyj/p/4159745.html 像素格式——PIXELFORMATDESCRIPT.设备上下文.渲染上下文 在OpenG ...
- leetcode 25. K 个一组翻转链表
# coding:utf-8 __author__ = "sn" """ 25. K 个一组翻转链表 给你一个链表,每 k 个节点一组进行翻转,请你返 ...
- Visual Studio Code修改全屏背景
打开VSCode安装目录,找到workbench.desktop.main.css文件 在最后一行添加以下代码: body{ pointer-events:auto !important; backg ...
- Codeforces Round #621 (Div. 1 + Div. 2) D
题意: 给n,m,k,有n个点,m条线,距离都是一: 有k个特殊点,选择其中两个,进行相连,距离变为1,使得原本的最短路,经过相连改变小或者不变,最终结果是所有结果里面的最大距离. 思路: 选择i,j ...