結果

問題 No.921 ずんだアロー
ユーザー poi_kyopropoi_kyopro
提出日時 2019-11-08 22:04:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 526 ms / 2,000 ms
コード長 725 bytes
コンパイル時間 1,871 ms
コンパイル使用メモリ 71,844 KB
実行使用メモリ 61,016 KB
最終ジャッジ日時 2023-10-13 03:52:10
合計ジャッジ時間 11,374 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,612 KB
testcase_01 AC 123 ms
55,976 KB
testcase_02 AC 124 ms
55,888 KB
testcase_03 AC 126 ms
55,876 KB
testcase_04 AC 124 ms
55,716 KB
testcase_05 AC 121 ms
55,828 KB
testcase_06 AC 161 ms
55,920 KB
testcase_07 AC 139 ms
55,664 KB
testcase_08 AC 129 ms
55,728 KB
testcase_09 AC 133 ms
55,712 KB
testcase_10 AC 526 ms
60,276 KB
testcase_11 AC 503 ms
60,332 KB
testcase_12 AC 324 ms
60,352 KB
testcase_13 AC 478 ms
60,292 KB
testcase_14 AC 507 ms
60,160 KB
testcase_15 AC 407 ms
60,796 KB
testcase_16 AC 224 ms
59,332 KB
testcase_17 AC 475 ms
61,016 KB
testcase_18 AC 501 ms
60,476 KB
testcase_19 AC 503 ms
60,584 KB
testcase_20 AC 510 ms
60,540 KB
testcase_21 AC 510 ms
60,320 KB
testcase_22 AC 516 ms
60,432 KB
testcase_23 AC 501 ms
60,468 KB
testcase_24 AC 506 ms
60,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int sum = 1;
        int size[] = new int[n];
        boolean flag = true;
        
        for(int i = 0; i < n; i++){
            size[i] = stdIn.nextInt();
        }
        
        for(int i = 1; i < n; i++){
            if(flag){
                if(size[i] == size[i - 1]){
                    sum++;
                }else{
                    flag = false;
                }
            }else{
                sum++;
                flag = true;
            }
        }
        
        System.out.println(sum);
        
        
    }
}
0