日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Virtual Judge —— Nim TopCoder - 11469

發(fā)布時(shí)間:2024/5/6 编程问答 55 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Virtual Judge —— Nim TopCoder - 11469 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Problem Statement 問(wèn)題陳述

Alice and Bob are going to play a famous game called Nim.
愛麗絲和鮑勃將要玩一個(gè)著名的游戲叫尼姆。
In the game Nim, first they set up stones in K piles containing a1,…,aK stones respectively.
在尼姆游戲中,首先在K堆中分別設(shè)置了包含a1,…,aK的石頭。
Then they alternatively take turns (Alice moves first).
然后他們輪流移動(dòng)(愛麗絲先移動(dòng))。
On a player’s turn the player chooses a pile and takes some (at least one) stones from that pile.
輪到玩家時(shí),玩家選擇一堆石頭,從那堆石頭中取出一些(至少一塊)。
If there are no piles left which contain any stones, the player loses.
如果沒有剩余的包含任何石頭的樁,玩家將失敗。

Since they like prime numbers very much, they decided to make each ai a prime number less than or equal to L.
因?yàn)樗麄兎浅O矚g素?cái)?shù),所以他們決定使每個(gè)ai都成為小于或等于L的素?cái)?shù)。
Given K and L return the number of such initial setups which allows Bob to win, assuming they play optimally, modulo 1,000,000,007.
給定k和l返回允許Bob獲勝的初始設(shè)置的數(shù)量,假設(shè)它們發(fā)揮的最佳,模100000000007。

Definition 定義

Class: Nim
類別:尼姆
Method: count
方法:計(jì)數(shù)
Parameters: int, int
參數(shù):int,int
Returns: int
返回:int
Method signature: int count(int K, int L)
方法簽名:int count(int k,int l)
(be sure your method is public)
(確保您的方法是公開的)

Notes 筆記

  • Two setups are considered different if at least one ai is different between them (for example, (a1,a2,a3)=(2,5,7) and (2,7,5) are considered different).
  • 如果兩個(gè)設(shè)置之間至少有一個(gè)AI不同(例如,(A1、A2、A3)=(2、5、7)和(2、7、5)視為不同),則認(rèn)為兩個(gè)設(shè)置不同。

Constraints 約束條件

  • K will be between 1 and 1000000000(=109), inclusive.
  • K包含在1和1000000000之間。
  • L will be between 2 and 50000, inclusive.
  • L包含在2和50000之間。

Examples 樣例

  • 3
    7
    Returns: 6
    Prime numbers <= 7 are 2, 3, 5 and 7. Bob can win if the initial setup is (2,5,7) or its permutation. So return 3! = 6.

  • 4
    13
    Returns: 120
    Bob can win if the initial setup is (p,p,p,p) for some prime p<=13, (p,p,q,q) or its permutation for p<q<=13, or (3,5,11,13) or its permutation. So return 6+(6C2*6)+4!=6+90+24=120.

  • 10
    100
    Returns: 294844622

  • 123456789
    12345
    Returns: 235511047
    This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. ?2010, TopCoder, Inc. All rights reserved.

    總結(jié)

    以上是生活随笔為你收集整理的Virtual Judge —— Nim TopCoder - 11469的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。