博弈论 Orz ZYF 从前往后递推……反正最大才10^6,完全可以暴力预处理每个数的状态是必胜还是必败(反正才两个后继状态),然后O(1)查询……我是SB 1 /************************************************************** 2 ...
分类:
其他好文 时间:
2015-02-27 20:05:14
阅读次数:
156
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it
as a li...
分类:
其他好文 时间:
2015-02-27 11:54:33
阅读次数:
125
题意:给出n,将前n个整数顺次写在一起,统计各个数字出现的次数。用的最笨的办法--直接统计-- 后来发现网上的题解有先打表来做的 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 char ...
分类:
其他好文 时间:
2015-02-26 16:09:21
阅读次数:
90
题目大意:Steve和Digit轮流取甜甜圈,有n个,每次不能取超过m个(1
用d[i][j][u][0]表示目前总共有i个甜甜圈,其中j个还未被取,u个在Steve处,且下一步到Steve走时,Steve能吃到的最多的甜甜圈,用d[i][j][u][1]表示目前总共有i个,j个未取,u个在Steve处,且下一步到Digit走时,Digit能吃到的最多的甜甜圈。
状态转移方程:...
分类:
其他好文 时间:
2015-02-26 01:24:26
阅读次数:
295
A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers...
分类:
其他好文 时间:
2015-02-25 21:11:47
阅读次数:
126
数位DP#include #include using namespace std;const int MAX_DIGIT = 15;const int MAX_K = 10005;long long n;int f[MAX_DIGIT];long long memoize[MAX_DIGIT][M...
分类:
其他好文 时间:
2015-02-24 21:00:31
阅读次数:
220
Description描述Let f(n) be a sum of digits for positive integer n. If f(n) is one-digit number then it is a digital root for n and otherwise digital roo...
分类:
其他好文 时间:
2015-02-24 16:20:33
阅读次数:
180
基本的数位DP,注意记录那些状态可以用最小的空间判断出整除性。#include #include using namespace std;#define D(x) const int MAX_DIGIT_NUM = 20;int f[MAX_DIGIT_NUM];long long memoize[...
分类:
其他好文 时间:
2015-02-24 12:29:09
阅读次数:
135
数位dp,许多数位dp需要统计某种模式(子串)出现的数量,这种题通常需要在递归参数中加入高位已经出现过的模式的数量。#include #include using namespace std;#define D(x) const int MAX_DIGIT = 40;long long n;int ...
分类:
其他好文 时间:
2015-02-23 18:59:51
阅读次数:
131
【题意】:输出四位数中所有十进制=十二进制=十六进制的数。
【思路】:穷举就OK。避免重复可以再函数中增加一个位数的参数,这样三个函数写一个就行。
【AC代码】:
#include
#include
#include
#include
#include
#include
using namespace std;
int getDec(int x)
{
int sum =...
分类:
其他好文 时间:
2015-02-22 23:08:38
阅读次数:
337