提出 #75448613


ソースコード 拡げる

#include <iostream>
#include <string>
using namespace std;

const int MOD = 998244353;

int main() {
    string S;
    cin >> S;
    int n = S.length();
    
    long long ans = 0;
    int l = 0;
    
    for (int r = 0; r < n; ++r) {
        if (r > 0 && S[r] == S[r-1]) {
            l = r; 
        }
        ans = (ans + (r - l + 1)) % MOD;
    }
    
    cout << ans << endl;
    
    return 0;
}

提出情報

提出日時
問題 C - Not Adjacent
ユーザ Chen_Zhen_DY
言語 C++23 (GCC 15.2.0)
得点 300
コード長 425 Byte
結果 AC
実行時間 6 ms
メモリ 3964 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 2
AC × 28
セット名 テストケース
Sample sample_01.txt, sample_02.txt
All min.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, sample_01.txt, sample_02.txt
ケース名 結果 実行時間 メモリ
min.txt AC 1 ms 3464 KiB
random_01.txt AC 5 ms 3788 KiB
random_02.txt AC 4 ms 3664 KiB
random_03.txt AC 5 ms 3916 KiB
random_04.txt AC 3 ms 3688 KiB
random_05.txt AC 5 ms 3788 KiB
random_06.txt AC 3 ms 3788 KiB
random_07.txt AC 5 ms 3876 KiB
random_08.txt AC 2 ms 3728 KiB
random_09.txt AC 5 ms 3788 KiB
random_10.txt AC 4 ms 3656 KiB
random_11.txt AC 5 ms 3876 KiB
random_12.txt AC 1 ms 3772 KiB
random_13.txt AC 6 ms 3868 KiB
random_14.txt AC 4 ms 3672 KiB
random_15.txt AC 6 ms 3912 KiB
random_16.txt AC 2 ms 3700 KiB
random_17.txt AC 6 ms 3916 KiB
random_18.txt AC 4 ms 3660 KiB
random_19.txt AC 5 ms 3912 KiB
random_20.txt AC 2 ms 3728 KiB
random_21.txt AC 5 ms 3964 KiB
random_22.txt AC 4 ms 3808 KiB
random_23.txt AC 5 ms 3928 KiB
random_24.txt AC 2 ms 3708 KiB
random_25.txt AC 6 ms 3876 KiB
sample_01.txt AC 1 ms 3468 KiB
sample_02.txt AC 1 ms 3432 KiB