Children’s Queue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 16006    Accepted Submission(s): 5337 Problem Description There are many students in PHT School. One day, the headmaster whose n…
http://poj.org/problem?id=2506 题意: 思路:递推.a[i]=a[i-1]+2*a[i-2]. 计算的时候是大整数加法.错了好久,忘记考虑1了...晕倒. #include<iostream> #include<string> #include<cstring> #include<cstdio> using namespace std; int n; ][]; void cacl(int i) { int k; ]); ]);…
题目大意:给你一个n*n的矩阵,现在问对于每个k\le n,求出所有k*k的子矩阵中,元素种类数不超过q的矩阵个数,n\le 1500, q\le 10 先考虑最暴力的做法: 对于每个格子,求出以它为子矩阵右下角时,左上角能到达的最远位置,时间O(n^{4}).再统计起来跑个后缀和 考虑可以$n^{3}$时的做法: 双指针对一条斜线上的格子进行维护,暴力进行指针移动时的更新 虽然双指针是一种优化递推,但其并没有利用q=10的性质 考虑直接递推 我们从左到右再从上到下依次处理每个点 对于每个格子维…
Children’s Queue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13333    Accepted Submission(s): 4364 Problem Description There are many students in PHT School. One day, the headmaster whose na…
Children's Queue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11117    Accepted Submission(s): 3577 Problem Description There are many students in PHT School. One day, the headmaster whose n…
Children’s Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12101 Accepted Submission(s): 3953 Problem Description There are many students in PHT School. One day, the headmaster whose name is…
Children’s Queue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17918    Accepted Submission(s): 5976 Problem Description There are many students in PHT School. One day, the headmaster whose na…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1297 题目大意: 有n个同学, 站成一排, 要求 女生最少是两个站在一起, 问有多少种排列方式. 题目分析: 1.  假设第n个学生是个男生, 我们可以直接将他放在最后有 dp[n-1]种 即: ...............M   dp[n-1] 2.假设第n个放女生,要求两个女生在一起, 我们可以直接在最后放两个女生 即: .............FF    dp[n-2] 3.假设我们后面…
题目链接: http://codeforces.com/problemset/problem/353/D?mobile=true H. Queue time limit per test 1 secondmemory limit per test 256 megabytes 问题描述 There are n schoolchildren, boys and girls, lined up in the school canteen in front of the bun stall. The b…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4651 题意:求n的整数拆为Σ i 的个数. 一般的递归做法,或者生成函数做法肯定会超时的... 然后要奇葩的用到一个<五边形数定理>,然后根据公式递推就可以了,先预处理下,复杂度O(n*sqrt(n)).. //STATUS:C++_AC_796MS_1012KB #include <functional> #include <algorithm> #include <…