#includeint sum(int* a, int n){ return (0 ==
n)?0:(sum(a,n-1) + a[n-1]);}void sum1(int* a, int n,int& s){ if(0 == n)
return; else {...
分类:
其他好文 时间:
2014-05-19 20:33:20
阅读次数:
381
题意:就是一个人走到一个城市就会记录与该城市相连的城市有多少,最后判断这些城市是否全部相连;样例输入87 7
4 3 3 3 2 1105 4 3 3 2 2 2 1 1
1样例输出NOYES解题思路:其实就是判断无向连通图,sum#include#include#include #includeu...
分类:
其他好文 时间:
2014-05-19 10:13:47
阅读次数:
306
题目链接:HDU 1394 Minimum Inversion
Number【题意】给你一个1~N的数字组成的初始序列,然后每一次都将第一个数字移到最后,形成新的序列,然后求出这些序列的逆序数中的最小值。【思路】开始可以用任意一种方法(线段树
or 暴力 or 树状数组)计算出初始数列的逆序数sum...
分类:
其他好文 时间:
2014-05-19 09:50:31
阅读次数:
282
oracle使用LEFT JOIN关联产生的问题在查询结果中使用CASE WHEN
无法判断查询方式一: 1 SELECT 2 CASE WHEN (SELECT CAST(SUM(CASE 3 WHEN
(ALLOCABLE_PRIME_CURRENCY_VALUE IS NULL AND ST....
分类:
数据库 时间:
2014-05-18 20:08:35
阅读次数:
1129
分析:暴力要超时,所以把每个数字转换为长度为32的0-1字符串,用字典树。因为其公共前缀的特性,空间上可以承受。因为是二叉树,用node[SIZE][2]存放。不知道new速度是否会慢很多,所以没用指针。...
分类:
其他好文 时间:
2014-05-18 18:37:37
阅读次数:
218
Xor Sum
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others)
Total Submission(s): 4445 Accepted Submission(s): 652
Problem Description
Zeus 和 Prometheus 做了一个游戏,...
分类:
其他好文 时间:
2014-05-18 05:21:59
阅读次数:
277
Given a triangle, find the minimum path sum
from top to bottom. Each step you may move to adjacent numbers on the row
below.For example, given the fol...
分类:
其他好文 时间:
2014-05-18 02:11:19
阅读次数:
302
hash做法:#include#includeconst int Max =
100010;int home[Max],away[Max],hash[Max];int main(){ int n,sum,total; int i,j;
while(scanf("%d",&n)!=E...
分类:
其他好文 时间:
2014-05-17 21:44:37
阅读次数:
504
原题链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1425
DP题。 f[i][j]表示当前数字为i,分解式中最大质数为j的方案数,那么,状态转移方程为: f[i][j] = sum(f[i-j][k]) 其中...
分类:
其他好文 时间:
2014-05-17 20:41:17
阅读次数:
296
1 //Accepted 250MS 2480K 2 #include 3 #include 4
const int MAXN = 50005; 5 struct node 6 { 7 int l,r; 8 int add,sum; 9
}f[3*MAXN];10 int n;...
分类:
其他好文 时间:
2014-05-17 20:36:37
阅读次数:
316