[Init] Solved solutions

This commit is contained in:
tiennm99 committed 2023-03-02 20:58:03 +07:00
1 parent 51f667ac81
commit 20542601dd
131 files changed
+4148

No files matched your search

+31
View File
@@ -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);
}
}
}