/*自我修改* Note: 堆排序(Heap Sort)*/#include using
namespace std;// 输出当前堆的排序状况void PrintArray(int data[], int size){ for (int i=1;
i a[i]) // 符号修改后形成...
分类:
其他好文 时间:
2014-05-25 19:07:25
阅读次数:
227
题目链接:hdu 3269 Convex
题目大意:给出n个点,问任选四个点可以组成多少个凸四边形。
解题思路:和uav11529的做法是一样的,只不过求的东西不一样。
#include
#include
#include
#include
#include
using namespace std;
typedef long long ll;
const int N =...
分类:
其他好文 时间:
2014-05-25 18:38:17
阅读次数:
155
哎,本来是想学学矩阵构造的方法的,,突然发现自己不用看直接就会yy构造。。。
看下右边有什么。。
题目地址:Another kind of Fibonacci
AC代码:
#include
#include
#include
#include
using namespace std;
const int mod=10007;
int p[4][4],a[4][4],tmp...
分类:
其他好文 时间:
2014-05-25 18:23:49
阅读次数:
268
我们经常会用到平年和闰年对应的天数,直接对数组静态初始化固然可以,但是手写起来很容易写错,所以用个函数得对应天数。
完整代码:
#include
using namespace std;
int count = 0;
int a[2][12];
void init_arr(int a[2][12])
{
for(int i=0;i<13;i++)
{
if(i==1||i==3||i=...
分类:
其他好文 时间:
2014-05-25 18:16:39
阅读次数:
258
题目:
链接:点击打开链接
题意:
n个课程m天完成,a[i][j]表示用j天完成第i个课程得到的价值,求最大价值。
算法:
分组背包。
思路:
m天是总容量,n是组数。
代码:
#include
#include
#include
using namespace std;
int n,m;
int a[110][...
分类:
其他好文 时间:
2014-05-25 18:16:18
阅读次数:
223
题目来源:POJ 2019 Cornfields
题意:求正方形二维区间最大最小值的差
思路:直接二维ST搞 试模版而已
#include
#include
#include
using namespace std;
const int maxn = 255;
int dp[maxn][maxn][8][8];
int dp2[maxn][maxn][8][8];
int a[...
分类:
其他好文 时间:
2014-05-25 10:21:07
阅读次数:
246
形态:
实现:
/***************************************8
二叉树的三叉链表存储
by Rowandjj
2014/5/23
*****************************************/
#include
using namespace std;
typedef int ElemType;
//------...
分类:
其他好文 时间:
2014-05-25 08:52:26
阅读次数:
239
哈希表简单实现,练个手
#include "stdafx.h"
#include
using namespace std;
#define HASHSIZE 12
typedef struct HashTable
{
int *elem;
int count;
}HashTable;
int m = 0;
void Print(HashTable* ...
分类:
其他好文 时间:
2014-05-25 07:02:06
阅读次数:
169
题目来源:Light OJ 1234 Harmonic Number
题意:
思路:没思路啊 这个是高数的东西 发散 n足够大时它无穷大 直接公式解
#include
#include
#include
#include
#include
#include
using namespace std;
const int maxn = 1000010;
const doub...
分类:
其他好文 时间:
2014-05-25 06:18:44
阅读次数:
213
/***************************************************
二叉树的线性存储
by Rowandjj
2014/5/23
***************************************************/
#include
#include
using namespace std;
#define MAX 255
#define...
分类:
其他好文 时间:
2014-05-25 04:25:41
阅读次数:
261