mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-10-15 02:16:44 +00:00
[Init] Solved solutions
This commit is contained in:
1 parent
51f667ac81
commit
20542601dd
131 files changed
+4148
No files matched your search
+31
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
namespace problem_999B
|
||||
{
|
||||
class problem_999B
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
int n = int.Parse(Console.ReadLine());
|
||||
string s = Console.ReadLine();
|
||||
for (int i = 1; i <= n; i++)
|
||||
{
|
||||
if (n%i == 0)
|
||||
{
|
||||
s = Reverse(s.Substring(0, i)) + s.Substring(i);
|
||||
}
|
||||
}
|
||||
Console.Write(s);
|
||||
}
|
||||
public static string Reverse(string s)
|
||||
{
|
||||
char[] a = s.ToCharArray();
|
||||
char[] b = new char[s.Length];
|
||||
for (int i = 0; i < s.Length; i++)
|
||||
{
|
||||
b[i] = a[s.Length - 1 - i];
|
||||
}
|
||||
return new string(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user