結果

問題 No.1506 Unbalanced Pocky Game
ユーザー ripity
提出日時 2021-12-13 21:04:32
言語 Java
(openjdk 23)
結果
AC  
実行時間 795 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 2,135 ms
コンパイル使用メモリ 74,716 KB
実行使用メモリ 56,316 KB
最終ジャッジ日時 2024-07-22 20:22:19
合計ジャッジ時間 32,291 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 63
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        String[] ans = {"Bob","Alice"};
        for( int i = 0; i < N; i++ ) {
            A[i] = sc.nextInt();
        }
        
        for( int i = N-1; i >= 0; i-- ) {
            if( A[i] != 1 ) {
                System.out.println(ans[(N-i)%2]);
                return;
            }
        }
        
        System.out.println(ans[N%2]);
        
    }
    
}
0