题解 | 甜蜜的博弈

甜蜜的博弈

https://www.nowcoder.com/practice/d3934f2d05624c8fa1a748ef225d0460

找规律

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int T=in.nextInt();
        while(T-->0){
            int N=in.nextInt();
            //1 A
            //2 A
            //3 B
            //4 A
            //5 A
            //6 B
            //7
            //8
            //9
            if(N==3||N==6||(N>=9&&(N%2==1))){
                System.out.println("Bob");
            }else{
                System.out.println("Alice");
            }

        }
    }
}

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务