原题链接:codeforce 267 Div2 C问题描述:给定长度为n的数组a[],从中选择k个长度为m的子数组,要求和最大。形式描述为:选择$k$个子数组[$l_1$,?$r_1$],?[$l_2$,?$r_2$],?...,?[$l_k$l1,?$r_k$](1?≤?$l_1$?≤$r_1$?...
分类:
其他好文 时间:
2014-09-22 17:31:12
阅读次数:
200
1 #include 2 #include 3 #include 4 #include 5 #define N 500005 6 using namespace std; 7 typedef long long LL; 8 LL prefix[N], suffix[N], num[N]; 9 LL....
分类:
其他好文 时间:
2014-09-13 17:10:55
阅读次数:
122
1 /* 2 题意:给定一个字符串中没有任何长度>1的回文子串!求按照字典序的该串的下一个字符串 3 也不包含长度>1的任何回文子串! 4 5 思路:从最低位进行枚举,保证第i位 不与 第 i-1位和第 i-2位相同就好了!那么因为前边i-1 6 ...
分类:
其他好文 时间:
2014-09-10 17:36:50
阅读次数:
182
codeforce 7C &&拓展欧几里得 详解...
分类:
其他好文 时间:
2014-09-03 19:53:07
阅读次数:
183
Caisa去商店买Sugar 商店找零的最低单位为元 低于1元的部分每分找一个糖果 商店有n种Suger Caisa有s元钱 她只买一种Sugar 输入n s 再输入n行 每行两个数a b 表示第i种Sugar的单价为a元b分 求Sugar最多能被找多少糖果
#include
#include
#include
using namespace std;
int m...
分类:
其他好文 时间:
2014-08-31 09:19:21
阅读次数:
212
??
题意 Caisa走台阶 有n个台阶 第i个台阶的高度为h[i] 从第i个台阶包括地面到下一个台阶得到的能量为h[i]-h[i+1] 能量不足以跳到下一个台阶就要补充能量 求Caisa跳完所有台阶最少要补充多少能量
水题 直接模拟
#include
#include
using namespace std;
const int N = 100005;
int...
分类:
其他好文 时间:
2014-08-31 09:19:11
阅读次数:
249
题意
求n以内等于两个连续素数的和加上1的数的个数 n不大于1000
#include
#include
#include
using namespace std;
const int N = 1000;
int n, k, ans;
bool isPrime (int a)
{
for (int i = 2; i <...
分类:
数据库 时间:
2014-08-30 13:57:29
阅读次数:
293
给出数n和m,求n的所有排列中,模m得0的有多少个 n
(1?≤?n?18) and
m (1?≤?m?≤?100).
暴力法我们直接枚举n的所有排列,显然18!超时。
考虑怎么dp
假设给了我们数n=23765
显然有
(237%m*10+6)%m=2376%m
(367%m*10+2)%m=3672
我们很自然的想到了
这样的状态转移
dp[i][k]
i代表取...
分类:
其他好文 时间:
2014-08-26 15:38:36
阅读次数:
216
这道题给出了一个犀利的公式x=b·s(x)a+c,
s(x)为求x的各个位数之和,求在0-1000000000之间找到满足这个公式值,明显暴力枚举绝对超时,遍历一边都得一分钟的时间,所以就要分析公式
可以看出s(x)^a=(x-c)/b,也就是说(x-c)/b一定是一个整数,所以循环可以写成for(int i=c;i
的以上思路都是遍历x的值,仔细看公式,里面有一个s(x)^a,说明一个问...
分类:
其他好文 时间:
2014-08-21 11:32:54
阅读次数:
165
Games with Rectangle
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d
& %I64u
Submit Status
Description
In this task Anna and Maria play the following game. Initia...
分类:
其他好文 时间:
2014-08-17 11:50:42
阅读次数:
329