求从上到下 从左到右 从左上到右下 从右上到左下的 最长的S和s串
#include
#include
#include
using namespace std;
const int maxn = 1444;
char a[maxn][maxn];
int dp[2][maxn][2][4];
int main()
{
int n;
int ans1 = 0, ans2 = 0;
s...
分类:
编程语言 时间:
2014-11-25 18:40:07
阅读次数:
235
题目大意:给你一个n(10^8)以内,让你求出1-n中与n互质的数x^4的和。
解题思路:先把n进行分解质因数,然后容斥求出所有与n不互质的数x^4的和,然后做减法用总的减去不互质的就是互质的。
注意:1^4+2^4+……+n^4 = n(n+1)(2n+1)(3n^2+3n-1)/30.
The Boss on Mars
Time Limit: 2000/1000 MS (Jav...
分类:
其他好文 时间:
2014-11-21 10:43:11
阅读次数:
269
Martian Addition
Time Limit: 2 Seconds Memory Limit: 65536 KB
In the 22nd Century, scientists have discovered intelligent residents live on the Mars. Martians are very fond of mathematics...
分类:
其他好文 时间:
2014-11-19 20:39:08
阅读次数:
205
Most PowerfulTime Limit: 2 Seconds Memory Limit: 65536 KBRecently, researchers on Mars have discovered N powerful atoms. All of them are different. Th...
分类:
其他好文 时间:
2014-11-18 01:34:47
阅读次数:
208
这道题木意思是给你一个连续的序列,要求找出其中连续和为给定值的一段序列,如果不存在这样的序列,那么就输出值大于给定值且最接近的这样值的一个序列。题目数据量是10^5,如果用N*2复杂度肯定会超时,所以我采用的是On算法。但是在求和少于给定值的过程中所需的步骤不确定。总体效果还算不错,最大时间是39m...
分类:
其他好文 时间:
2014-11-15 15:32:11
阅读次数:
125
============问题描述============ 先整理了下目前1至5季的源码欢迎下载不需要资源分http://download.csdn.net/detail/shao5155285/4853586另外缺少的部分已在说明中备注了,如果有找到的童鞋欢迎补齐CSDN资源里所说的完整版我也下载测...
分类:
移动开发 时间:
2014-11-11 15:55:15
阅读次数:
187
package mars.handler;import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.view.V...
分类:
其他好文 时间:
2014-11-11 12:18:03
阅读次数:
177
http://acm.hdu.edu.cn/showproblem.php?pid=4059
定义S = 1^4 + 2^4 + 3^4+.....+n^4,现在减去与n互质的数的4次方,问共减少了多少。
容斥原理,可以先把与n不互质的数的4次方求出来。那就先对n进行质因子分解,对质因子的组合运用容斥原理,质因子个数为奇数就加,偶数就减。其实与求[1,n]内与n互质的数的个数类...
分类:
其他好文 时间:
2014-11-02 21:03:17
阅读次数:
179
#include #include #include using namespace std;char tbl[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A',...
分类:
其他好文 时间:
2014-11-02 20:45:41
阅读次数:
163
============问题描述============ 先整理了下目前1至5季的源码欢迎下载不需要资源分http://download.csdn.net/detail/shao5155285/4853586另外缺少的部分已在说明中备注了,如果有找到的童鞋欢迎补齐CSDN资源里所说的完整版我也下载测...
分类:
移动开发 时间:
2014-10-20 23:10:54
阅读次数:
215