提出 #26645507
ソースコード 拡げる
using System;
using System.Linq;
public class Program
{
public static void Main(string[] args)
{
var s = Console.ReadLine();
var smin = s;
var smax = s;
for (var i = 0; i < s.Length -1; i++)
{
var temp = "";
for (var j = 1; j < s.Length; j++)
{
temp += s[j];
}
temp += s[0];
for (var j = 0; j < s.Length; j++)
{
if (temp[j] < smin[j])
{
smin = temp;
break;
}
else if (smin[j] == temp[j]) continue;
else break;
}
for (var j = 0; j < s.Length; j++)
{
if (temp[j] > smax[j])
{
smax = temp;
break;
}
else if (smax[j] == temp[j]) continue;
else break;
}
s = temp;
}
Console.WriteLine(smin);
Console.WriteLine(smax);
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - String Shifting |
| ユーザ | chachamaru |
| 言語 | C# (.NET Core 3.1.201) |
| 得点 | 200 |
| コード長 | 1158 Byte |
| 結果 | AC |
| 実行時間 | 208 ms |
| メモリ | 38840 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example_00.txt, example_01.txt, example_02.txt |
| All | example_00.txt, example_01.txt, example_02.txt, handmade_00.txt, handmade_01.txt, handmade_02.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| example_00.txt | AC | 83 ms | 25508 KiB |
| example_01.txt | AC | 79 ms | 25580 KiB |
| example_02.txt | AC | 83 ms | 25560 KiB |
| handmade_00.txt | AC | 74 ms | 25428 KiB |
| handmade_01.txt | AC | 79 ms | 25592 KiB |
| handmade_02.txt | AC | 71 ms | 25576 KiB |
| test_00.txt | AC | 205 ms | 38752 KiB |
| test_01.txt | AC | 140 ms | 38840 KiB |
| test_02.txt | AC | 137 ms | 38708 KiB |
| test_03.txt | AC | 82 ms | 30224 KiB |
| test_04.txt | AC | 110 ms | 38564 KiB |
| test_05.txt | AC | 79 ms | 25760 KiB |
| test_06.txt | AC | 208 ms | 38656 KiB |
| test_07.txt | AC | 93 ms | 38652 KiB |
| test_08.txt | AC | 97 ms | 38692 KiB |