摘要: For example, 4139 is a balanced number with pivot fixed at 3. The torqueses are 4*2 + 1*1 = 9 and 9*1 = 9, for left part and right part, respectively. It's your job to calculate the number of balanced numbers in a given range [x, y].思路:枚举中心轴的位置,然后针对这个位置,算出结果,结果记得去掉全0的情况。View Code 1 #include<i 阅读全文
posted @ 2013-05-07 22:48 诺小J 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 如果这个数要被自己的每个数位上的数整除,那么这个数一定能被每个数位上的最小公倍数整除。那么剩下的就是用记忆话搜索和枚举来解题了。View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstdlib> 4 #include<cstring> 5 #include<cmath> 6 typedef long long LL; 7 int const M = 55; 8 int const N = 20; 9 int const MOD= 2520;10 LL l,r;11 阅读全文
posted @ 2013-05-07 17:30 诺小J 阅读(145) 评论(0) 推荐(0) 编辑
摘要: windy定义了一种windy数。不含前导零且相邻两个数字之差至少为2的正整数被称为windy数。windy想知道,在A和B之间,包括A和B,总共有多少个windy数? 解题思路:简单枚举+记忆化搜索View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstdlib> 4 #include<cstring> 5 #include<cmath> 6 using std::cout; 7 using std::endl; 8 typedef long long LL; 阅读全文
posted @ 2013-05-07 13:55 诺小J 阅读(142) 评论(0) 推荐(0) 编辑