結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー C_nena_E
提出日時 2020-01-31 22:04:19
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 1,977 ms
コンパイル使用メモリ 74,704 KB
実行使用メモリ 64,588 KB
最終ジャッジ日時 2024-09-17 08:18:58
合計ジャッジ時間 10,846 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] map = new int[N]; 
        for(int i = 0; i < N-1; i++){
            map[sc.nextInt()]++;
            map[sc.nextInt()]++;
        }
        int cnt1 = 0;
        int cnt0 = 0;
        for(int i = 0; i < N; i++){
            if(map[i] == 1){
                cnt1++;
            }
            if(map[i] == 0){
                cnt0++;
            }
        }
        if(cnt0 == 0 || (cnt0 == 1 && cnt1 == 0)){
            System.out.println("Bob");
        }else{
            System.out.println("Alice");
        }
    }
}
0