CF 999B. Reversing Encryption【模拟/string reverse】
【链接】:CF
【代码】:
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
#define debug puts
#define setp cout << fixed << setprecision(3)
#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
const int N=3e5+5;
const int MOD=1e9+7;
const ll INF=1e18+8;
int n,k;
int a[N];
/*
给一个长度为n的字符串,经过他的因子个数的几次翻转,让你求最初的字符串。
*/
int main()
{
FAST_IO
while(cin>>n)
{
string s;
cin>>s;
for(int i=2;i<=n;i++)
{
if(n%i==0)
reverse(s.begin(),s.begin()+i);
}
cout<<s<<endl;
}
}
/*
10
rocesfedoc
codeforces
16
plmaetwoxesisiht
thisisexampletwo
*/
CF 999B. Reversing Encryption【模拟/string reverse】的更多相关文章
- CodeForces - 999B Reversing Encryption
B - Reversing Encryption A string s of length n can be encrypted by the following algorithm: iterate ...
- [C/C++] String Reverse 字符串 反转
#include <iostream> #include <string> #include <algorithm> #include <cstring> ...
- [string]Reverse Words in a String
Given an input string, reverse the string word by word. For example,Given s = "the sky is blue& ...
- LeetCode 5:Given an input string, reverse the string word by word.
problem: Given an input string, reverse the string word by word. For example: Given s = "the sk ...
- Reversing Encryption(模拟水题)
A string ss of length nn can be encrypted(加密) by the following algorithm: iterate(迭代) over all divis ...
- CF Soldier and Cards (模拟)
Soldier and Cards time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- 2018.08.22 NOIP模拟 string(模拟)
string [描述] 给定两个字符串 s,t,其中 s 只包含小写字母以及*,t 只包含小写字母. 你可以进行任意多次操作,每次选择 s 中的一个*,将它修改为任意多个(可以是 0 个)它的前一个字 ...
- [CSP-S模拟测试]:Reverse(模拟+暴力+剪枝)
题目描述 小$G$有一个长度为$n$的$01$串$T$,其中只有$T_S=1$,其余位置都是$0$.现在小$G$可以进行若干次以下操作: $\bullet$选择一个长度为K的连续子串($K$是给定的常 ...
- [CSP-S模拟测试]:reverse(模拟)
题目传送门(内部题56) 输入格式 第一行包含一个整数:$T$,表示数据组数.接下来$T$行,每行包含两个字符串:$a\ b$. 输出格式 对于每组数据,如果存在$c$,输出最长的情况下字典序最大的$ ...
随机推荐
- 【题解】NOI2015寿司晚宴
想好久啊+不敢写啊……但果然人还是应当勇敢自信,只有坚定地去尝试,才会知道最后的结果.1A真的太开心啦,不过好像我的做法还是比较复杂的样子……理解起来应该算是比较容易好懂的类型,大家可以参考一下思路~ ...
- 2018牛客多校第一场 B.Symmetric Matrix
题意: 构造一个n*n的矩阵,使得Ai,i = 0,Ai,j = Aj,i,Ai,1+Ai,2+...+Ai,n = 2.求种类数. 题解: 把构造的矩阵当成邻接矩阵考虑. 那么所有点的度数都为2,且 ...
- [Leetcode] text justification 文本对齐
Given an array of words and a length L, format the text such that each line has exactly L characters ...
- BZOJ3456 城市规划 【多项式求逆】
题目链接 BZOJ3456 题解 之前我们用分治\(ntt\)在\(O(nlog^2n)\)的复杂度下做了这题,今天我们使用多项式求逆 设\(f_n\)表示\(n\)个点带标号无向连通图数 设\(g_ ...
- Super Moban
HAO BAN ZI 包括求解,判断无解,求自由变元个数以及标记不确定的变元.来源:http://blog.csdn.net/keshuqi/article/details/51921615 #inc ...
- POJ1984:Navigation Nightmare(带权并查集)
Navigation Nightmare Time Limit: 2000MS Memory Limit: 30000K Total Submissions: 7871 Accepted: 2 ...
- HDU 4320 Arcane Numbers 1 (数论)
A - Arcane Numbers 1 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64 ...
- [bzoj4766]文艺计算姬——完全二分图生成树个数
Brief Description 求\(K_{n,m}\) Algorithm Design 首先我们有(Matrix Tree)定理,可以暴力生成几组答案,发现一些规律: \[K_{n,m} = ...
- [bzoj3132]上帝造题的七分钟——二维树状数组
题目大意 你需要实现一种数据结构,支援以下操作. 给一个矩阵的子矩阵的所有元素同时加一个数. 计算子矩阵和. 题解 一看这个题,我就首先想到用线段树套线段树做. 使用二维线段树的错误解法 其实是第一次 ...
- webstorm es6 语法报错
设置settings javascript language version后 <script>标签加个 type <script type="text/ecmascrip ...