# include
# include
# include
# include
using namespace std;
int max(int a,int b)
{
return a>b?a:b;
}
int main()
{
int T,n,t,k,m,i,hh,min,id,num,x;
int last[1010];//最后一次开始炒饭的时间
int cot[1010];/...
分类:
其他好文 时间:
2014-07-30 14:45:53
阅读次数:
164
string str="4+4+2.1";要的效果: double sum=4+4+2.1;方案一:动态计算表达式: 1 public class Expression 2 { 3 object instance; 4 MethodInfo method; ...
分类:
其他好文 时间:
2014-07-30 14:42:33
阅读次数:
250
枚举所有相邻城市,作为起点,多次spfa,然后每次在想去的城市中找出spfa后的距离起点最短的花费时间
#include
#include
#include
using namespace std;
#define MAX 1005
#define INF 1<<30
int T,S,D;
struct Edge{
int to,time,next;
}edge[MAX*2...
分类:
其他好文 时间:
2014-07-30 12:19:03
阅读次数:
215
场景:导入一个 sql 文件,但是 总是在执行几十句sql之后就失败了,打开失败日志 就一句 MySQL server has gone away 我使用了2个步骤,但是感觉是第2步成功的 1: 先看看 max_allowed_packet , 使用语法为 show global variables...
分类:
数据库 时间:
2014-07-30 12:02:43
阅读次数:
273
HDU 1166【题意】:n个阵营一字排开,每个初始有a[i]个人。现有两种操作:Q a b 查询[a,b]之间总人数并输出A/S a b 在a号位添加/删除b个人【分析】:最基本的单点更新和区间查询,维护节点信息sum[o]【代码】: 1 #include 2 #include 3 #incl.....
分类:
其他好文 时间:
2014-07-30 11:56:23
阅读次数:
450
最基础的背包问题:每种物品仅有一件,可以选择放或者不放! 动态转移方程:f[i, v] = max { f [i-1][v] , f [i-1] [j - c[i] ]+w[i] } ; // 不放第 i 件 // 如果放进去(但是要保证放进去前,剩余空间够大 ) 比较这两项的价值,我们会选择最大的...
分类:
其他好文 时间:
2014-07-30 11:31:03
阅读次数:
151
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which...
分类:
其他好文 时间:
2014-07-30 11:30:33
阅读次数:
247
int?n=0;
int?max?=?100;
//通常的做法(省略上下文)
if(n>=max)
{
????n?=?0;
}
n++;
//巧妙的做法
n%=max
n++
分类:
其他好文 时间:
2014-07-30 10:15:03
阅读次数:
222
很典型的线段树,注意就是一个数字如果变成了斐波那契数字之后如果在change的话,它是不会反生改变的,因为最近的斐波那契数字就是它本身了啊。
用一个flag表示这一段上的数字是否change过,如果flag == 1已经change过,就不会在向下更新。否则的话就进行更新,最后会到达一个节点,更新这个节点。这里用暴力更新就行,找到最近的斐波那契数字。
Add就是一个点更新,sum求和就是一个区...
分类:
其他好文 时间:
2014-07-30 10:07:43
阅读次数:
438
本题是利用counting sort的思想去解题。
注意本题,好像利用直接排序,然后查找rank是会直接被判WA的,奇怪的判断系统。
因为分数值的范围是0到100,非常小,而student 号码又非常大,故此天然的需要利用counting sort的情况。
#include
#include
const int MAX_N = 101;
int arr[MAX_N];
int...
分类:
其他好文 时间:
2014-07-30 10:06:33
阅读次数:
214