結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー bluemeganebluemegane
提出日時 2021-11-06 10:44:32
言語 C#
(.NET 7.0.402)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 911 bytes
コンパイル時間 9,862 ms
コンパイル使用メモリ 147,384 KB
実行使用メモリ 164,288 KB
最終ジャッジ日時 2023-08-07 02:48:19
合計ジャッジ時間 10,724 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
27,320 KB
testcase_01 AC 50 ms
27,120 KB
testcase_02 AC 51 ms
27,012 KB
testcase_03 AC 50 ms
27,236 KB
testcase_04 AC 50 ms
26,980 KB
testcase_05 AC 51 ms
27,224 KB
testcase_06 AC 51 ms
27,156 KB
testcase_07 AC 51 ms
27,308 KB
testcase_08 AC 51 ms
27,544 KB
testcase_09 AC 51 ms
27,492 KB
testcase_10 AC 50 ms
27,404 KB
testcase_11 AC 51 ms
27,112 KB
testcase_12 AC 51 ms
29,312 KB
testcase_13 AC 50 ms
27,448 KB
testcase_14 AC 50 ms
29,148 KB
testcase_15 AC 50 ms
26,996 KB
testcase_16 AC 51 ms
27,452 KB
testcase_17 AC 50 ms
27,296 KB
testcase_18 AC 51 ms
27,152 KB
testcase_19 AC 52 ms
27,456 KB
testcase_20 AC 51 ms
29,244 KB
testcase_21 AC 51 ms
29,152 KB
testcase_22 AC 51 ms
27,196 KB
testcase_23 AC 51 ms
164,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 172 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/

ソースコード

diff #

using System.Collections.Generic;
using System.Linq;
using System;

public class Hello
{
    static void Main()
    {
        var s = Console.ReadLine().Trim();
        getAns(s);
    }
    static void getAns(string s)
    {
        var ss = "";
        foreach (var x in s)
        {
            ss += Convert.ToString(Convert.ToInt32(x.ToString(), 16), 2);
        }
        var ans = new int[8];
        var ssL = ss.Length;
        var sub = ssL % 3;
        var w1 = ss.Substring(0, sub);
        if (sub != 0) ans[Convert.ToInt32(w1, 2)]++;
        var p = sub;
        while (p < ssL)
        {
            var ww = ss.Substring(p, 3);
            ans[Convert.ToInt32(ww, 2)]++;
            p += 3;
        }
        var res = new List<int>();
        var ansmax = ans.Max();
        for (int i = 0; i < 8; i++) if (ans[i] == ansmax) res.Add(i);
        Console.WriteLine(string.Join(" ", res));
    }
}
0