题解:

  将一个数的指数看着一个堆,问题变成这些堆的异或值

  分析一个堆的情况,打SG表。

#include<stdio.h>
#include<string.h>
char sg[]; char getsg(int x)
{
if(sg[x]>=) return sg[x];
bool hash[]= {};
for(int i=; i<; i++)
{
if(x&(<<i))
{
int t=i+,tmp=x;
while(t<=)
{
if(tmp&(<<(t-))) tmp-=<<(t-);
t+=i+;
}
hash[getsg(tmp)]=;
}
//printf("%d %d\n",i,getsg((1<<i)-1));
}
int i=;
while(hash[i]) i++;
return sg[x]=i;
} int main()
{
memset(sg,-,sizeof(sg));
sg[]=;
int i=;
getsg((<<i)-);
for(int i=; i<=; i++)
{
printf("%d %d\n",i,sg[(<<i)-]);
}
return ;
}

打表找规律

CF 317D Game with Powers的更多相关文章

  1. CF 305C ——Ivan and Powers of Two——————【数学】

    Ivan and Powers of Two time limit per test 1 second memory limit per test 256 megabytes input standa ...

  2. CF 1095C Powers Of Two(二进制拆分)

    A positive integer xx is called a power of two if it can be represented as x=2y, where y is a non-ne ...

  3. CF 1095C Powers Of Two

    题目连接:http://codeforces.com/problemset/problem/1095/C 题目: C. Powers Of Two time limit per test 4 seco ...

  4. CF 702B Powers of Two(暴力)

    题目链接: 传送门 Devu and Partitioning of the Array time limit per test:3 second     memory limit per test: ...

  5. CF 622F The Sum of the k-th Powers——拉格朗日插值

    题目:http://codeforces.com/problemset/problem/622/F 发现 sigma(i=1~n) i 是一个二次的多项式( (1+n)*n/2 ),sigma(i=1 ...

  6. CF 622 F The Sum of the k-th Powers —— 拉格朗日插值

    题目:http://codeforces.com/contest/622/problem/F 设 f(x) = 1^k + 2^k + ... + n^k 则 f(x) - f(x-1) = x^k ...

  7. ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'

    凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...

  8. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  9. cf Round 613

    A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...

随机推荐

  1. 一款jQuery仿海尔官网全屏焦点图特效代码

    一款jQuery仿海尔官网全屏焦点图特效代码,带有左右箭头的jQuery焦点图切换特效. 当焦点图切换时,下方的三块小图也相对应的进行切换.并且特效还兼容头疼的IE6.赶快去和谐了它吧! 适用浏览器: ...

  2. NavigationBar的简单设置

    http://blog.csdn.net/hufeng825/article/details/7643532#) .Label属性设置 titleLabel = [[UILabel alloc] in ...

  3. Ajax入门小例子

    大牛文章:http://www.cnblogs.com/guduoduo/p/3681296.html                               ---Ajax基础学习 http:/ ...

  4. Vim自动补全神器:YouCompleteMe

    第一次听说这个插件还是在偶然的情况下看到别人的博客,听说了这个插件的大名.本来打算在实训期间来完成安装的,无奈网实在不给力,也就拖到了回家的时候.在开始准备工作的时候就了解到这个插件不是很容易安装,安 ...

  5. mysql学习笔记之基础篇

    数据库学习之基础篇 ① 开放数据库互连(Open Database Connectivity,ODBC ② 结构化查询语言(Structured Query Language) ③ 进入mysql:M ...

  6. virtualbox centos安装增强工具

    系统的,VBoxLinuxAdditions-amd64.run 是用于64位系统的.执行以下命令来安装sh ./VBoxLinuxAdditions-x86.run 5.安装成功后重启系统.

  7. json的序列化和反序列化支持时间格式转换

    .NET自带的json序列有时间格式问题,为了解决自己写了个json格式的序列化和反序列化 1.引入的命名空间 using System; using System.Collections.Gener ...

  8. Very large tabs in eclipse panes on Ubuntu

    http://stackoverflow.com/questions/11805784/very-large-tabs-in-eclipse-panes-on-ubuntu ou can edit E ...

  9. boost::bind

    bind并不是一个单独的类或函数,而是非常庞大的家族,依据绑定的参数个数和要绑定的调用对象类型,总共有十个不同的形式,但它们的名字都叫bind. bind接受的第一个参数必须是一个可调用对象f,包括函 ...

  10. DevExpress控件使用系列--ASPxTreeList

      控件功能 结合列表控件及树控件的优点,在列表控件中实现类型树的多层级操作 官方说明 http://documentation.devexpress.com/#AspNet/clsDevExpres ...