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 ...
随机推荐
- 题解【POJ2155】Matrix
Description Given an \(N \times N\) matrix \(A\), whose elements are either \(0\) or \(1\). \(A[i, j ...
- Go操作influxDB
influxDB 安装 下载 https://portal.influxdata.com/downloads/ 这里需要注意因为这个网站引用了google的api所以国内点页面的按钮是没反应的,怎 ...
- 【C语言】用指针作为形参完成数据的升序排列
#include<stdio.h> void sort(int *x,int n); int main() { ] = { ,,,,,,,,, },i; sort(arr, ); prin ...
- [USACO13JAN]Cow Lineup
Description Luogu3069 USACO Solution 由于两个点之间最多可以有\(k+1\)种牛,而牛的种数是单调的.所以可以用尺取法(区间伸缩法),每次右移右端点后,让左端点不断 ...
- 找不到方法:'System.Net.Http.HttpRequestMessage System.Web.Http.Controllers.HttpActionContext.get_Request()'
出现这种情况一般是引用了.net standard 库解决方案1:在web.config 文件中增加如下节点 <dependentAssembly> <assemblyIdentit ...
- Linux上后台运行node和springboot服务
环境:Ubuntu18.04 阿里云云服务器 尝试全局安装forever和pm2均失败,最后以linux自带的nohub启动,以前同样用nohub启动springboot 命令: nohup npm ...
- Django框架-路由层
Django框架-路由层 一.URL配置(URLconf) 1.基本格式 from django.conf.urls import url urlpatterns = [ url(正则表达式, vie ...
- 浏览器渲染页面原理,reflow、repaint及其优化
浏览器的主要组件包括: 1. 用户界面 - 包括地址栏.前进/后退按钮.书签菜单等.除了浏览器主窗口显示的你请求的页面外,其他显示的各个部分都属于用户界面. 2. 浏览器引擎 - ...
- IPSec无法建立?注意第一阶段hash sha !
该篇注意记录一下,有些情况下,我们配置了IPSec ,但是就是无法建立,发现连第一阶段都无法建立起来. 1.检查配置无问题 2.开启debug crypto isakmp发现有IKE的重传 3.sho ...
- atoi()函数的用法
注意:atoi()函数并不能单纯的把某字符串中的某字母转化为单个数字. 用法参考:https://www.cnblogs.com/ralap7/p/9171613.html