Just Skip The Problem

Posted 2462478392lee

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Just Skip The Problem相关的知识,希望对你有一定的参考价值。

http://acm.hdu.edu.cn/showproblem.php?pid=6600

题意:给你一个数x,允许你多次询问yi,然后回答你x xor yi 是否等于yi,询问尽量少的次数以保证能求出xi是几,求出这样询问次数最少的询问方案数。

最优方案就是对每位进行询问,每次只让yi的一位是1,一共n个二进制位。方案数为n!

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e6+10;
const int mod=1e6+3;
ll a[maxn];
int main()

    a[1]=1;
    for(int i=2;i<=mod;i++)
    
        a[i]=a[i-1]*i%mod;
    
    ll n;
    while(~scanf("%lld",&n))
    
        if(n>=mod)
             printf("0\n");
        else 
             printf("%lld\n",a[n]);
    
    return 0;
            

 

以上是关于Just Skip The Problem的主要内容,如果未能解决你的问题,请参考以下文章

ZOJ 2974 Just Pour the Water

IBM: For Blockchain, Food Safety Is Just the Beginning

[CF1267J] Just Arrange the Icons - 贪心

[2016-3-29]OMG美语每日笔记-What would you say if you start feel like the other person is just not in the m

B. The World Is Just a Programming Task (Hard Version)

D - The World Is Just a Programming Task (Easy Version)思维