From 4fdb6a4181ab201bc449eba286b7d993eb16fdb5 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 20 Jul 2016 12:58:18 +0800 Subject: [PATCH] Create 1404_qiqijianglu.cpp From http://blog.csdn.net/qiqijianglu/article/details/7881099 --- HDOJ/1404_qiqijianglu.cpp | 84 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 HDOJ/1404_qiqijianglu.cpp diff --git a/HDOJ/1404_qiqijianglu.cpp b/HDOJ/1404_qiqijianglu.cpp new file mode 100644 index 0000000..12c9446 --- /dev/null +++ b/HDOJ/1404_qiqijianglu.cpp @@ -0,0 +1,84 @@ +/* +HDU 1404 +*/ +#include +#include +#include +#include +using namespace std; + +const int MAXN=1000000; +int sg[MAXN]; +int get_length(int n)//得到整数n的位数 +{ + if(n/100000) return 6; + if(n/10000) return 5; + if(n/1000) return 4; + if(n/100) return 3; + if(n/10) return 2; + return 1; +} + +void _extend(int n)//sg[n]=0;表示n为后者必胜 + //那么所以可以一步变成n的都是前者必胜 +{ + int len=get_length(n); + int i; + for(i=len;i>=1;i--)//每一个位上加上一个数 + { + int m=n; + int base=1; + for(int j=1;j