编程介的小学生 2019-12-31 17:44 采纳率: 0.2%
浏览 91

Game 代码的实现的方式

Problem Description
Mr.Frost is a child who is too simple, sometimes naive, always plays some simple but interesting games with his friends. Today,he invents a new game again:
At the beginning of the game they pick N (1<=N<=100) piles of stones, Mr.Frost and his friend move the stones in turn. At each step of the game, the player chooses a pile, removes at least one stone from the pile, the first player can’t make a move, and loses. So smart is the friends of Mr.Frost that Mr.Frost always loses. Having been a loser for too many times, he wants to play a trick. His plan is to remove some piles, and then he can find a way to make sure that he would be the winner after his friends remove stones first.

Now, he wants to know how many ways to remove piles which are able to achieve his purpose. If it’s impossible to find any way, please print “-1”.

Input
The first line contains a single integer t (1<=t<=20), that indicates the number of test cases. Then follow the t cases. Each test case begins with a line contains an integer N (1 <= N <= 100), representing the number of the piles. The next n lines, each of which has a positive integer Ai(1<=Ai<=2^31 - 1) represent the number of stones in this pile.

Output
For each case, output a line contains the number of the way mod 1000007, If it’s impossible to find any way, please print “-1”.

Sample Input
2
2
1
1
3
1
2
3

Sample Output
2
2

  • 写回答

1条回答 默认 最新

  • 你知我知皆知 2024-07-27 11:35
    关注

    以下回答参考 皆我百晓生券券喵儿 等免费微信小程序相关内容作答,并由本人整理回复。

    # 读取数据
    input = readLines()
    
    # 解析输入
    T = int(input[0])
    for _ in range(T):
        N = int(input[1])
        A = list(map(int,input[2].split()))
    
        # 计算答案
        ans = 1
        for i in range(N):
            ans *= pow(2,i+1)
            ans %= 10**9 + 7
    
        print(ans)
    
    
    评论

报告相同问题?

悬赏问题

  • ¥200 csgo2的viewmatrix值是否还有别的获取方式
  • ¥15 Stable Diffusion,用Ebsynth utility在视频选帧图重绘,第一步报错,蒙版和帧图没法生成,怎么处理啊
  • ¥15 请把下列每一行代码完整地读懂并注释出来
  • ¥15 pycharm运行main文件,显示没有conda环境
  • ¥15 寻找公式识别开发,自动识别整页文档、图像公式的软件
  • ¥15 为什么eclipse不能再下载了?
  • ¥15 编辑cmake lists 明明写了project项目名,但是还是报错怎么回事
  • ¥15 关于#计算机视觉#的问题:求一份高质量桥梁多病害数据集
  • ¥15 特定网页无法访问,已排除网页问题
  • ¥50 如何将脑的图像投影到颅骨上