提出 #75444036


ソースコード 拡げる

import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String input=sc.next();
        long total=0;
        long countsubstring=0;
        long mod=998244353;
        
        
        
        for(int i=0;i<input.length();i++){
            if(i==0 || input.charAt(i)==input.charAt(i-1)){
                countsubstring=1;
            }else{
                countsubstring++;
            }
            total=(total+countsubstring)%mod;
        }
        System.out.println(total);
    }
}

提出情報

提出日時
問題 C - Not Adjacent
ユーザ renu_
言語 Java24 (OpenJDK 24.0.2)
得点 300
コード長 584 Byte
結果 AC
実行時間 152 ms
メモリ 44920 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 74 ms 40252 KiB
random_01.txt AC 140 ms 44436 KiB
random_02.txt AC 132 ms 43300 KiB
random_03.txt AC 142 ms 44776 KiB
random_04.txt AC 122 ms 42796 KiB
random_05.txt AC 144 ms 44848 KiB
random_06.txt AC 122 ms 42432 KiB
random_07.txt AC 152 ms 44312 KiB
random_08.txt AC 123 ms 42732 KiB
random_09.txt AC 126 ms 44188 KiB
random_10.txt AC 135 ms 43760 KiB
random_11.txt AC 142 ms 44632 KiB
random_12.txt AC 93 ms 41356 KiB
random_13.txt AC 140 ms 44460 KiB
random_14.txt AC 126 ms 43512 KiB
random_15.txt AC 146 ms 44464 KiB
random_16.txt AC 121 ms 42944 KiB
random_17.txt AC 149 ms 44920 KiB
random_18.txt AC 135 ms 43276 KiB
random_19.txt AC 145 ms 44036 KiB
random_20.txt AC 118 ms 43336 KiB
random_21.txt AC 147 ms 44312 KiB
random_22.txt AC 134 ms 43240 KiB
random_23.txt AC 139 ms 44320 KiB
random_24.txt AC 90 ms 40776 KiB
random_25.txt AC 138 ms 44504 KiB
sample_01.txt AC 69 ms 40300 KiB
sample_02.txt AC 68 ms 40204 KiB