結果

問題 No.2021 Not A but B
ユーザー 👑 kakel-sankakel-san
提出日時 2022-07-29 21:41:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 748 bytes
コンパイル時間 1,160 ms
コンパイル使用メモリ 68,288 KB
実行使用メモリ 34,896 KB
最終ジャッジ日時 2023-09-26 20:11:43
合計ジャッジ時間 4,886 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
22,512 KB
testcase_01 AC 57 ms
22,324 KB
testcase_02 AC 59 ms
22,564 KB
testcase_03 AC 59 ms
22,568 KB
testcase_04 AC 59 ms
24,436 KB
testcase_05 AC 58 ms
24,440 KB
testcase_06 AC 58 ms
24,296 KB
testcase_07 AC 59 ms
24,456 KB
testcase_08 AC 77 ms
28,552 KB
testcase_09 AC 77 ms
30,112 KB
testcase_10 AC 77 ms
29,968 KB
testcase_11 AC 76 ms
29,920 KB
testcase_12 AC 75 ms
28,216 KB
testcase_13 AC 76 ms
30,196 KB
testcase_14 AC 75 ms
29,972 KB
testcase_15 AC 76 ms
30,000 KB
testcase_16 AC 77 ms
28,176 KB
testcase_17 AC 77 ms
30,000 KB
testcase_18 AC 77 ms
30,016 KB
testcase_19 AC 77 ms
29,976 KB
testcase_20 AC 77 ms
28,080 KB
testcase_21 AC 61 ms
24,512 KB
testcase_22 AC 59 ms
22,336 KB
testcase_23 AC 59 ms
24,416 KB
testcase_24 AC 60 ms
22,512 KB
testcase_25 AC 61 ms
22,492 KB
testcase_26 AC 67 ms
22,920 KB
testcase_27 AC 83 ms
33,864 KB
testcase_28 AC 81 ms
33,900 KB
testcase_29 AC 86 ms
34,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(int n) => Enumerable.Repeat(0, n).Select(_ => NList).ToArray();
    static void Main()
    {
        var n = NN;
        var s = ReadLine();
        var set = new HashSet<long>();
        for (var i = 0; i + 1 < s.Length; ++i)
        {
            var key = 0L;
            if (s[i] == 'A') key += i + 1;
            if (s[i + 1] == 'A')
            {
                key = key * 1_000_000_000L + i + 2;
            }
            set.Add(key);
        }
        WriteLine(set.Count);
    }
}
0