Just skip this problem

10 篇文章 0 订阅

Y_UME has just found a number x in his right pocket. The number is a non-negative integer ranging from 0 to 2n−1 inclusively. You want to know the exact value of this number. Y_UME has super power, and he can answer several questions at the same time. You can ask him as many questions as you want. But you must ask all questions simultaneously. In the i-th question, you give him an integer yi ranging from 0 to 2n−1 inclusively, and he will answer you if x&yi equals to yi or not. Note that each question you ask has a index number. Namely, the questions are ordered in certain aspect. Note that Y_UME answer all questions at the same time, which implies that you could not make any decision on the remaining questions you could ask according to some results of some of the questions.

YUME 刚刚在他的右口袋发现了一个数字。这个数字是一个非负数,从0,2^(n-1)的闭区间范围内选。你想知道这个数字的具体值。YUME有超能力,他可以同时回答若干问题。你可以想问多少就问多少,但是必须同时问问题。第i个问题内,你给他一个从0,2^(n-1)的闭区间内出现的数字,他会回答你x&yi等不等于yi。注意你问的每个问题都有一个索引值。也就是说问题是以一种特定的方式排序的,注意到YUME同时回答所有问题,这意味着你不能根据你问过的一些问题所得到的答案进行决断。


You want to get the exact value of x and then minimize the number of questions you will ask. How many different methods may you use with only minimum number of questions to get the exact value of x? You should output the number of methods modulo 106+3.

你想去知道x的特定值,有多少种方法可以通过最少的数字得到数字x的具体值?你应当把这个方法数目输出出来并取余1e6+3;
Two methods differ if and only if they have different number of questions or there exsits some i satisfying that the i-th question of the first method is not equal to the i-th of the second one.

两个方法是不同的,当且仅当存在一个第i步骤和另一种方案的i步骤不对应。

Input

There are multiple test cases.

Each case starts with a line containing one positive integer n(n≤109).

Output

For each test case, output one line containing an integer denoting the answer.

Sample Input

2

Sample Output

2

如果能妥妥的知道一个数字的值?那肯定要把它二进制表达式里每一位的0,1状态弄清楚,彻底弄清楚一个位的1就得找一个只有这一位是1的数字来进行按位与运算从而判断。那么,二进制表达式子里有多少位,就应当有多少个这样的单位数字来作为询问方案。对于n个长度的二进制表达式,也就是需要n个数字。而由于打乱顺序后的方案异于初始,所以直接进行全排列即可得出所有答案。也就是n的阶乘。

不过由于阶乘是一个连乘过程,所以根据同余模定理:(a*b)%c=(a%c*b%c)%c,如果当n大于1e6+3时,阶乘表达式中必然存在一个1e6+3,而这个1e6+3取模1e6+3之后就变成了0,使得整个连乘式为0。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值