【链接】: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】的更多相关文章

  1. CodeForces - 999B Reversing Encryption

    B - Reversing Encryption A string s of length n can be encrypted by the following algorithm: iterate ...

  2. [C/C++] String Reverse 字符串 反转

    #include <iostream> #include <string> #include <algorithm> #include <cstring> ...

  3. [string]Reverse Words in a String

    Given an input string, reverse the string word by word. For example,Given s = "the sky is blue& ...

  4. 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 ...

  5. Reversing Encryption(模拟水题)

    A string ss of length nn can be encrypted(加密) by the following algorithm: iterate(迭代) over all divis ...

  6. CF Soldier and Cards (模拟)

    Soldier and Cards time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  7. 2018.08.22 NOIP模拟 string(模拟)

    string [描述] 给定两个字符串 s,t,其中 s 只包含小写字母以及*,t 只包含小写字母. 你可以进行任意多次操作,每次选择 s 中的一个*,将它修改为任意多个(可以是 0 个)它的前一个字 ...

  8. [CSP-S模拟测试]:Reverse(模拟+暴力+剪枝)

    题目描述 小$G$有一个长度为$n$的$01$串$T$,其中只有$T_S=1$,其余位置都是$0$.现在小$G$可以进行若干次以下操作: $\bullet$选择一个长度为K的连续子串($K$是给定的常 ...

  9. [CSP-S模拟测试]:reverse(模拟)

    题目传送门(内部题56) 输入格式 第一行包含一个整数:$T$,表示数据组数.接下来$T$行,每行包含两个字符串:$a\ b$. 输出格式 对于每组数据,如果存在$c$,输出最长的情况下字典序最大的$ ...

随机推荐

  1. HDFS集群和YARN集群

    Hadoop集群环境搭建(一)   1集群简介 HADOOP集群具体来说包含两个集群:HDFS集群和YARN集群,两者逻辑上分离,但物理上常在一起 HDFS集群: 负责海量数据的存储,集群中的角色主要 ...

  2. BZOJ4347 POI2016Nim z utrudnieniem(博弈+动态规划)

    由nim游戏的结论,显然等价于去掉一些数使剩下的数异或和为0. 暴力的dp比较显然,设f[i][j][k]为前i堆移走j堆(模意义下)后异或和为k的方案数.注意到总石子数量不超过1e7,按ai从小到大 ...

  3. 【题解】MUTC2013idiots

    我是先知道的这题是FFT然后再做的,知道是FFT其实就是个套路题啦.首先,我们容易发现 \(P = \frac{a}{b}\) 其中a表示合法的方案数,而b表示全部的方案数. b的值即为\(C\lef ...

  4. [洛谷P1536]村村通

    题意:多组数据,当n为0时结束,每组数据表示有n个村子,m条路,求还需要建多少条路,使得所有的村子联通题解:用并查集求出有多少个联通块,然后求解 C++ Code: #include<cstdi ...

  5. 遇到问题---java---git下载的maven项目web用tomcat发布时不带子项目

    遇到的情况是用git下载maven项目,然后用mvn eclipse:eclipse命令标记为eclipse项目之后,使用maven插件导入之后用tomcat发布运行,发现maven关联的几个子项目没 ...

  6. 【BZOJ 2460 元素】

    Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 1555  Solved: 809[Submit][Status][Discuss] Descripti ...

  7. js金额转大写数字

    //金额转大写数字 const intToChinese = money => { //汉字的数字 let cnNums = new Array('零', '壹', '贰', '叁', '肆', ...

  8. 通过init-connect + binlog 实现MySQL审计功能

    背景: 假设这么一个情况,你是某公司mysql-DBA,某日突然公司数据库中的所有被人为删了. 尽管有数据备份,但是因服务停止而造成的损失上千万,现在公司需要查出那个做删除操作的人. 但是拥有数据库操 ...

  9. URAL1277 Cops and Thieves(最小割)

    Cops and Thieves Description: The Galaxy Police (Galaxpol) found out that a notorious gang of thieve ...

  10. Oracle SQL 疑难解析读书笔记(二、汇总和聚合数据)

    2.1 对某字段的值进行汇总 仅仅在两种特殊情况下,Oracle在聚合函数中考虑了NULL值.第一种是在GROUPING功能里,用来检验包含了NULL值的分析函数的结果,是直接由所在的表得来,还是由分 ...