现在位置: 首页 > lyjxzg发表的所有文章
  • 08月
  • 17日
综合 ⁄ 共 1023字 评论关闭
题目链接:hdu 4961 Boring Sum 题目大意:给定ai数组; 构造bi, k=max(j|0<j<i,aj%ai=0), bi=ak; 构造ci, k=min(j|i<j≤n,aj%ai=0), ci=ak; 求∑i=1nbi∗ci 解题思路:因为ai≤105,所以预先处理好每个数的因子,然后在处理bi,ci数组的时候,每次遍历一个数,就将其所有的因子更新,对于bi维护最大值,对于ci维护最小值。 #include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; typedef long long ll; const int maxn = 1e5; const int INF = 0x......
阅读全文
  • 04月
  • 23日
综合 ⁄ 共 2343字 评论关闭
博主新开了个人站点,你也可以在这看到这篇文章,点击打开链接 ——后台 转码 str= new String(str.getBytes("iso8859-1"),"gb2312"); str= new String(str.getBytes("iso8859-1"),"GBK"); servlet中 response.setContentType("text/html; charset=GBK"); ——前台 JSP中乱码 < %@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK" %> ——服务器 tomcat中 更改 Tomcat\conf\server.xml,指定浏览器的编码格式为“简体中文”: 把 <Connector port="8080" protocol="HTTP/1.1" connectionTimeout=......
阅读全文
  • 04月
  • 14日
综合 ⁄ 共 1620字 评论关闭
D1D2的250p都是水题,特别纯净的那种。   D1 500p HexatridecimalSum   高精度模板上吧!   D1 1000p IncreasingLists   花了半个下午搞定。首先搜索最长不下降序列划分逗号,然后贪心。贪心时注意:只要某一位被预置,并且与之前的string在该位不同,那么就可以对后面的数位置0.还有一些细节,比如开头不能为0。   string ans; class IncreasingLists { int lst[30]; string str[30], m; void print ( int n ) { for ( int i = 0; i < n; i ++ ) printf ( "%d ", lst[i] ); printf ( "/n" ); } void check ( int ......
阅读全文
  • 02月
  • 15日
综合 ⁄ 共 2758字 评论关闭
E. Pretty Song time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output When Sasha was studying in the seventh grade, he started listening to music a lot. In order to evaluate which songs he likes more, he introduced the notion of the song's prettiness. The title of the song is a word consisting of uppercase Latin letters. The prettiness of the song is the prettiness of its title. Let's define the simple prettiness of a word a......
阅读全文
  • 12月
  • 31日
综合 ⁄ 共 265字 评论关闭
#include<stdio.h> #include<stdlib.h> int cmp(const void *a,const void *b) { return *(int *)b-*(int *)a; } int main() { int op=1,a[4],sum; while(scanf("%d",&a[0])!=-1) { scanf("%d%d%d",&a[1],&a[2],&a[3]); qsort(a,4,sizeof(a[0]),cmp); sum=a[0]+a[1]; printf("Case %d: %d\n",op++,sum); } return 0; }
阅读全文
  • 05月
  • 07日
综合 ⁄ 共 179字 评论关闭
当我们有时候要更新 数据库中 同一个字段 根据不同情况更新不同的值,可以用 update Table set  field = (case  XX    when  XXXX  then XXX                                                             when   xxxx   then   xxxxxx else xxxx  end)
阅读全文
  • 03月
  • 17日
综合 ⁄ 共 1084字 评论关闭
容易得出简单的递推方程如下 f[i] = min{f[j] + sum[i] - sum[j] - (i-j) *x[j+1]   } 然后发现复杂度太高 这时可以看出是一个比较经典的斜率优化 f[i] =   min{f[j] +j *x[j+1] -sum[j] -i *x[j+1]}  +sum[i] 按照http://blog.csdn.net/sdj222555/article/details/8229192 中使用的斜率优化方法推导就行了 可以发现一些单调性是比较重要的 最后需要注意的由于有k这个条件的限制 所以某个决策点要入队的时候,需要延迟入队。 就是说走完 i 这个点的时候,把下一个点即(i+1)可能用到的状态加入队列,就是i-k+1 如代码所示 #incl......
阅读全文
  • 02月
  • 23日
综合 ⁄ 共 1694字 评论关闭
题目链接:Beauty Contest 题意:给n个点,求两个点的最远距离。 题解:最长的边肯定是凸多边形的对角线,所以求出凸包后遍历对角线,求出最大距离。 代码: #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <iostream> #include <algorithm> #include <queue> #include <stack> #include <vector> #include <deque> #include <set> #include <map> #include <string> using namespace std; #define For(i,a......
阅读全文
  • 02月
  • 05日
综合 ⁄ 共 7148字 评论关闭
什么是Schema XML Schema是用一套预先规定的XML元素和属性创建的,这些元素和属性定义了XML文档的结构和内容模式;XML Schema规定XML文档实例的结构和每个元素/属性的数据类型。Schema(模式):其作用与dtd一样,也是用于验证XML文档的有效性,只不过它提供了比dtd更强大的功能和更细粒度的数据类型,另外Schema还可以自定义数据类型。此外,Schema也是一个XML文件,而dtd则不是。 1、同样一个XML使用DTD和Schema进行校验: XML文档: <书本> <名称>书剑恩仇录</名称> <作者>金庸</作者>......
阅读全文
  • 01月
  • 17日
综合 ⁄ 共 52字 评论关闭
http://blog.csdn.net/a_eagle/article/details/7371974
阅读全文
  • 11月
  • 15日

KMP

综合 ⁄ 共 945字 评论关闭
hdu KMP中级题目总汇(转载自http://www.cnblogs.com/wuyiqi/archive/2012/01/05/2313746.html) 首先看我对kmp解决周期、前缀与后缀间关系的解释 http://www.cnblogs.com/wuyiqi/archive/2012/01/06/2314078.html hdu 3336  count the string 题意:求给定字符串含前缀的数量 abab 前缀为 a ab aba abab abab中共有六个子串是前缀a a ab ab aba abab 所以答案为6 利用kmp中的匹配原理可以完美的解决此题  a---------d-----    -----a---------d                i         j 如上所示,假设两串字符完全相等......
阅读全文
  • 09月
  • 19日
综合 ⁄ 共 1509字 评论关闭
After having checked out the BB (which I'd like to revisit with OS6) as well as some iPhone development (ergLog) I'm turning my attention to Android. I'll document some of the troubles and hopefully solutions I've found along the way.    Problem #1 After successfully installing Eclipse and AVD plugin I received the following error when restarting Eclipse: "Could not open Selected VM debug port (8700). Make sure you do not have another instance of DDMS or of the eclipse plugin running. If......
阅读全文