結果
問題 | No.113 宝探し |
ユーザー | fujita |
提出日時 | 2023-05-10 15:04:00 |
言語 | C# (.NET 8.0.203) |
結果 |
AC
|
実行時間 | 52 ms / 5,000 ms |
コード長 | 2,004 bytes |
コンパイル時間 | 13,456 ms |
コンパイル使用メモリ | 143,704 KB |
実行使用メモリ | 164,168 KB |
最終ジャッジ日時 | 2023-08-17 20:20:07 |
合計ジャッジ時間 | 16,613 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 49 ms
28,952 KB |
testcase_01 | AC | 49 ms
28,532 KB |
testcase_02 | AC | 50 ms
30,860 KB |
testcase_03 | AC | 52 ms
28,656 KB |
testcase_04 | AC | 52 ms
28,644 KB |
testcase_05 | AC | 50 ms
28,536 KB |
testcase_06 | AC | 50 ms
30,820 KB |
testcase_07 | AC | 50 ms
28,900 KB |
testcase_08 | AC | 50 ms
28,632 KB |
testcase_09 | AC | 50 ms
28,660 KB |
testcase_10 | AC | 50 ms
28,772 KB |
testcase_11 | AC | 51 ms
30,652 KB |
testcase_12 | AC | 51 ms
28,844 KB |
testcase_13 | AC | 51 ms
28,664 KB |
testcase_14 | AC | 50 ms
28,680 KB |
testcase_15 | AC | 49 ms
28,508 KB |
testcase_16 | AC | 48 ms
28,792 KB |
testcase_17 | AC | 50 ms
28,836 KB |
testcase_18 | AC | 50 ms
28,780 KB |
testcase_19 | AC | 49 ms
28,908 KB |
testcase_20 | AC | 49 ms
28,924 KB |
testcase_21 | AC | 49 ms
28,844 KB |
testcase_22 | AC | 49 ms
28,684 KB |
testcase_23 | AC | 49 ms
28,636 KB |
testcase_24 | AC | 49 ms
28,728 KB |
testcase_25 | AC | 49 ms
28,616 KB |
testcase_26 | AC | 48 ms
164,168 KB |
コンパイルメッセージ
Determining projects to restore... Restored /home/judge/data/code/main.csproj (in 154 ms). .NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f Copyright (C) Microsoft Corporation.All rights reserved. プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください main -> /home/judge/data/code/bin/Release/net6.0/main.dll main -> /home/judge/data/code/bin/Release/net6.0/publish/
ソースコード
using System; namespace yukicoder { class Program { static void Main(string[] args) { var str = Console.ReadLine(); string[] strings = new string[str.Length]; int sum = 0 , x = 0 , y = 0; for(int i = 0; i < str.Length; i++) { strings[i] = str.Substring(i, 1); if (strings[i] == "N") { x++; } else if (strings[i] == "S") { x--; } else if (strings[i] == "E") { y++; } else if (strings[i] == "W") { y--; } } if (x < 0) { x = x * -1; } if (y < 0) { y = y * -1; } sum = (x * x) + (y * y); double a = Math.Sqrt(sum); string b = a.ToString(); string[] str2 = new string[b.Length]; for (int i = 0; i < b.Length; i++) { str2[i] = b.Substring(i , 1); if (b.Substring(i, 1) == ".") { str2[i + 1] = b.Substring(i + 1, 1); str2[i + 2] = b.Substring(i + 2, 1); str2[i + 3] = b.Substring(i + 3, 1); str2[i + 4] = b.Substring(i + 4, 1); str2[i + 5] = b.Substring(i + 5, 1); if (int.Parse(b.Substring(i + 6, 1)) > 4) { int c = int.Parse(str2[i + 5] ) + 1; str2[i + 5] = c.ToString(); } break; } } foreach (var item in str2) { Console.Write(item); } } } }