結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー bluemeganebluemegane
提出日時 2021-11-06 10:44:32
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 911 bytes
コンパイル時間 19,045 ms
コンパイル使用メモリ 168,480 KB
実行使用メモリ 184,524 KB
最終ジャッジ日時 2024-04-24 21:06:58
合計ジャッジ時間 9,900 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
29,696 KB
testcase_01 AC 55 ms
29,568 KB
testcase_02 AC 55 ms
29,568 KB
testcase_03 AC 56 ms
29,440 KB
testcase_04 AC 57 ms
29,952 KB
testcase_05 AC 57 ms
29,184 KB
testcase_06 AC 53 ms
29,560 KB
testcase_07 AC 55 ms
29,568 KB
testcase_08 AC 55 ms
29,568 KB
testcase_09 AC 54 ms
29,696 KB
testcase_10 AC 55 ms
29,568 KB
testcase_11 AC 55 ms
29,568 KB
testcase_12 AC 55 ms
29,440 KB
testcase_13 AC 54 ms
29,440 KB
testcase_14 AC 56 ms
29,824 KB
testcase_15 AC 55 ms
29,824 KB
testcase_16 AC 54 ms
29,440 KB
testcase_17 AC 55 ms
29,568 KB
testcase_18 AC 56 ms
29,440 KB
testcase_19 AC 54 ms
29,312 KB
testcase_20 AC 54 ms
29,440 KB
testcase_21 AC 55 ms
29,440 KB
testcase_22 AC 56 ms
29,824 KB
testcase_23 AC 55 ms
184,524 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (105 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.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