2014-05-04 00:10 题目链接 原题: Write a function return an integer that satisfies the following conditions: ) positive integer ) no repeated digits, eg., (valid), (invalid) ) incremental digit sequence, eg., (valid) (invalid) ) the returned integer MUST be…
2014-05-02 03:37 题目链接 原题: A string is called sstring if it consists of lowercase english letters and no two of its consecutive characters are the same. You are given string s of length n. Calculate the number of sstrings of length that are not lexico…
2014-04-29 01:05 题目:数数从0到n总共有多少个数字‘2’? 解法:数位动态规划,可以O(log10(n))时间内解决. 代码: // 18.4 Count the number of 2s from 0 to n. #include <iostream> using namespace std; int main() { int d, i; long long int base; long long int sum; ]; long long int n; s[] = ; ;…