Crosses and Crosses
http://poj.org/problem?id=3537
// File Name: poj3537.cpp
// Author: bo_jwolf
// Created Time: 2013年10月04日 星期五 20:03:34#include<vector>
#include<list>
#include<map>
#include<set>
#include<deque>
#include<stack>
#include<bitset>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<ctime>using namespace std;const int maxn = 2005;
int sg[ maxn ];int dfs( int n ){bool vis[ maxn ] = { 0 };int i;if( n <= 0 )return 0;if( sg[ n ] >= 0 )return sg[ n ];for( i = 1; i <= n; ++i )vis[ dfs( n - i - 2 ) ^ dfs( i - 3 ) ] = 1;i = 0;while( vis[ i ] )++i;return sg[ n ] = i;
}int main(){int n;memset( sg, -1 , sizeof( sg ) );while( scanf( "%d", &n ) != EOF ){if( dfs( n ) ) printf( "1\n" );else printf( "2\n" );}
return 0;
}
Crosses and Crosses相关推荐
- poj 3537 Crosses and Crosses 博弈论之grundy值
题意: 给1*n的格子,轮流在上面叉叉,最先画得3个连续叉叉的赢.问先手必胜还是必败. 分析: 求状态的grundy值(也就是sg值),详细怎么求详见代码.为什么这么求要自己想的,仅仅可意会(别人都说 ...
- CF--思维练习-- CodeForces - 215C - Crosses(思维题)
ACM思维题训练集合 There is a board with a grid consisting of n rows and m columns, the rows are numbered fr ...
- HDU 4414 Finding crosses(搜索)
题目链接:HDU 4414 Finding crosses [题目大意] 给你一张n*n的图,由o #这两个元素组成,让我们找其中有多少十字架. 十字架由#构成 十字架的纵向长度等于横向长度 , 且这 ...
- 【CodeForces - 215C 】Crosses (思维,图形题)
题干: There is a board with a grid consisting of n rows and m columns, the rows are numbered from 1 fr ...
- HDU-4414 Finding crosses
问题描述: The Nazca Lines are a series of ancient geoglyphs located in the Nazca Desert in southern Peru ...
- 2. 离散特征处理方法--特征交叉 feature crosses
对于离散特征,如类别特征,除了常用的one-hot encoding(dummy encoding)方法,还有一种方法-特征交叉.前者可以学习到每个特征的main effects,但是不能学习到特征之 ...
- hdu 4414 Finding crosses
http://acm.hdu.edu.cn/showproblem.php?pid=4414 简单枚举 代码: #include <iostream> #include <cstdi ...
- codeforces1194B Yet Another Crosses Problem 思维
网址:http://codeforces.com/contest/1194/problem/B 题意: 给出一个点阵,问至少再需要涂黑多少个点,可以出现一个长度和宽度都达到点阵最大尺寸的十字. 题解: ...
- 《挑战程序设计竞赛(第2版)》习题册攻略
本项目来源于GitHub 链接: 项目GitHub链接 1 前言 项目为<挑战程序设计竞赛(第2版)>习题册攻略,已完结.可配合书籍或笔记,系统学习算法. 题量:约200道,代码注释内含详 ...
- HALCON示例程序measure_ring.hdev齿轮齿宽度测量
HALCON示例程序measure_ring.hdev齿轮齿宽度测量 示例程序源码(加注释) 关于显示类函数解释 read_image (Image, 'rings_and_nuts') dev_cl ...
最新文章
- 7个珍藏多年的网站,颠覆你的想象,值得收藏起来!
- 皮一皮:杯子不要买太奇怪的...
- Hadoop–Task 相关
- 更新代码到gitlab上
- MAX13085E/MAX485 _中文翻译
- 使用react实现select_React笔记——核心概念:9.表单
- javascript鼠标拖拽的那些事情
- [leetcode]5366. 检查网格中是否存在有效路径
- SqlServer使用表值函数汇总
- Unity中录制VR全景视频(可录制UGUI)
- 这些地区的大学,取消英语四六级口语考试!
- 幼师资格证综合素质计算机知识点,教师资格证 | 综合素质基本能力13个必备知识点...
- MIT 6.824 lab3 KVRaft
- sklearn模块之朴素贝叶斯:(二)伯努利模型的实现
- Nvidia最新三维重建技术Instant-ngp初探
- nvidia driveos(Drive AGX Orin板子P3710/P3663)单独烧录kernel
- Js如何删除所有子元素以及当前元素
- java的书可以二手_基于jsp的二手书图书-JavaEE实现二手书图书 - java项目源码
- 前端UI大全(针对后台管理系统)
- 中国RISC-V机遇与变革下,赛昉科技发布两款高性能新品