题目2 : 回文字符序列时间限制:2000ms单点时限:1000ms内存限制:256MB描述给定字符串,求它的回文子序列个数。回文子序列反转字符顺序后仍然与原序列相同。例如字符串aba中,回文子序列为"a", "a", "aa", "b", "aba",共5个。内容相同位置不同的子序列算不同的子序列...
分类:
其他好文 时间:
2015-04-20 14:43:11
阅读次数:
87
时间限制:2000ms
单点时限:1000ms
内存限制:256MB
描述
给定两个日期,计算这两个日期之间有多少个2月29日(包括起始日期)。
只有闰年有2月29日,满足以下一个条件的年份为闰年:
1. 年份能被4整除但不能被100整除
2. 年份能被400整除
输入
第一行为一个整数T,表示数据组数。
之后每组数据包含两行。每一行格式为"mont...
分类:
其他好文 时间:
2015-04-20 09:35:02
阅读次数:
132
通过好多遍终于AC了,我承认我很挫。。。
时间限制:2000ms
单点时限:1000ms
内存限制:256MB
描述
给定两个日期,计算这两个日期之间有多少个2月29日(包括起始日期)。只有闰年有2月29日,满足以下一个条件的年份为闰年:
年份能被4整除但不能被100整除
年份能被400整除
输入
第一行为一个整数T,表示数据组数。之后每组数据包含两行。每一行格式为”month day,...
分类:
其他好文 时间:
2015-04-20 09:33:25
阅读次数:
244
题目:统计起始日期之间有多少个2月29。#include
#include using namespace std;class Date
{
private:
int month;
int day;
int year; static int getMonthFromString(const string &s)
{...
分类:
其他好文 时间:
2015-04-20 09:29:38
阅读次数:
172
A:处理下日期,容斥加减一下
B:DP,dp[l][r]表示区间回文子序列个数
C:模拟退火过了,然后还有个比较科学的方法,就是枚举B点,XY轴分开考虑,三分求解
代码:
#include
#include
#include
#include
#include
using namespace std;
int t, year;
char m1[2][15];
int m[2]...
分类:
其他好文 时间:
2015-04-20 08:13:09
阅读次数:
127
动态规划
#include
#include
#include
#include
using namespace std;
char a[1005];
const int INF = 100007;
int num[1005];
int dp[1005][1005];
int main(){
int n;
cin >> n;
for(int cases = 1; cases...
分类:
其他好文 时间:
2015-04-19 22:50:14
阅读次数:
143
题目1 :2月19日时间限制:2000ms单点时限:1000ms内存限制:256MB描述给定两个日期,计算这两个日期之间有多少个2月29日(包括起始日期)。只有闰年有2月29日,满足以下一个条件的年份为闰年:1. 年份能被4整除但不能被100整除2. 年份能被400整除输入第一行为一个整数T,表示数...
分类:
其他好文 时间:
2015-04-19 21:02:11
阅读次数:
156
简单模拟题
#include
#include
using namespace std;
//判断是不是闰年
bool is(int year){
return year % 400 == 0?true:
(year % 100 == 0?false:(year % 4 == 0?true:false));
}
//判断结束日期是否不包括2月29
#define...
分类:
其他好文 时间:
2015-04-18 23:46:55
阅读次数:
167
这是一道dp题,设置dp[i][j]代表的是从i到j之间的有多少个回文子串,dp[i][j] = dp[i][num[1]] +1+ dp[num[1]+1][j - 1]+1......+dp[num[j]][j-1] + 1 ,num[i] 代表的是与i字符相同的上一个字符的位置!
时间限制:2000ms
单点时限:1000ms
内存限制:256MB
描...
分类:
其他好文 时间:
2015-04-18 14:34:44
阅读次数:
131
既然这个是资格赛, 时间也比较充裕, 我就讲解一下我做题的过程
Time Limit:2000ms
Case Time Limit:1000ms
Memory Limit:256MB
Description
Given a string, calculate the number of subsequences that are palindrome. ...
分类:
其他好文 时间:
2015-04-18 13:10:38
阅读次数:
162