結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー C_nena_EC_nena_E
提出日時 2020-01-31 22:04:19
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 2,575 ms
コンパイル使用メモリ 74,568 KB
実行使用メモリ 68,172 KB
最終ジャッジ日時 2023-10-17 09:51:16
合計ジャッジ時間 10,048 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
57,356 KB
testcase_01 AC 116 ms
57,412 KB
testcase_02 AC 110 ms
57,024 KB
testcase_03 AC 104 ms
56,264 KB
testcase_04 AC 114 ms
55,392 KB
testcase_05 AC 108 ms
56,280 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 142 ms
57,608 KB
testcase_09 AC 125 ms
57,524 KB
testcase_10 AC 127 ms
57,556 KB
testcase_11 AC 133 ms
57,652 KB
testcase_12 AC 121 ms
57,012 KB
testcase_13 WA -
testcase_14 AC 293 ms
59,960 KB
testcase_15 AC 280 ms
61,612 KB
testcase_16 WA -
testcase_17 AC 281 ms
60,956 KB
testcase_18 WA -
testcase_19 AC 403 ms
61,692 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 581 ms
68,136 KB
testcase_24 AC 585 ms
67,188 KB
testcase_25 AC 622 ms
67,696 KB
権限があれば一括ダウンロードができます

ソースコード

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