HDU 4957 Poor Mitsui
题目链接
思路:利用辗转相除法去贪心即可,注意容积为0的情况,这是个坑点
代码:
#include
#include
#include
using namespace std;
const int N = 45;
struct SB {
int a, b;
} sb[N];
bool cmp(SB x, SB y...
分类:
其他好文 时间:
2014-08-17 22:49:02
阅读次数:
227
典型的Joseph问题……由于数据范围小,直接暴力就可以解决了……用到了链表的数据结构……时间:90毫秒。#include "stdio.h"#include "string.h"struct lianbiao{ int prev,next;}p[152];const int INF=2147483...
分类:
其他好文 时间:
2014-08-17 21:15:32
阅读次数:
158
/*
说明:程序实现二维数组中插入列、插入行、交换两个指定位置的元素,并输出指定
位置元素的变化轨迹
*/
#include "stdafx.h"
#include
#include
/*二维数组最大行数和列数*/
#define MAX_ROW_NUM (9)
#define MAX_COL_NUM (9)
/*二维数组中各元素位置信息*/
typedef struct _PathN...
分类:
其他好文 时间:
2014-08-17 18:35:32
阅读次数:
261
值和引用类型 Value and Reference Types
在Swift中,有两种数据类型. 一是"值类型"(value type), 它是每一个实例都保存有各自的数据,通常定义为struct, enum或tuple. 二是"引用类型"(reference types),它是多实例共享一份数据,这种类型通常定义为class. 在本文中,我们将展示值类型和引用类型各自的优点以及如何在二者之间选择....
分类:
移动开发 时间:
2014-08-17 17:06:52
阅读次数:
358
值和引用类型Value and Reference Types在Swift中,有两种数据类型. 一是"值类型"(value type), 它是每一个实例都保存有各自的数据,通常定义为struct, enum或tuple. 二是"引用类型"(reference types),它是多实例共享一份数据,这...
分类:
移动开发 时间:
2014-08-17 16:57:42
阅读次数:
249
1 #include 2 #include 3 const int mod =1000000007; 4 const int inf = ~0u>>2; 5 const int maxn = 200010; 6 int lim; 7 struct Splay...
分类:
其他好文 时间:
2014-08-17 16:56:42
阅读次数:
363
#include#include#include#include#include#define eps 1e-7using namespace std;struct Point{ double x,y; Point(){} Point(double x,double y):x(x)...
分类:
其他好文 时间:
2014-08-17 16:55:42
阅读次数:
223
typedef int elemtype;
typedef struct
{
elemtype weight;
int parent,l_child,r_child;
} binarytree;
//2、构建最优二叉树
void CreateHuffman(int leafnum, binarytree *huffmantree)
{
//leafnum个叶子,决定nodenu...
分类:
其他好文 时间:
2014-08-17 14:22:32
阅读次数:
280
#ifndef __MAILBOX_H__#define __MAILBOX_H__#include #include #include typedef struct{ // uint32_t Capacity; uint8_t * Memory; uint32_t MailSize; ui...
分类:
其他好文 时间:
2014-08-17 14:19:12
阅读次数:
205
#include #include #include #include #include using namespace std;const double eps = 1e-6;const int MAXN = 100010;const double INF = 1e20;struct Point{...
分类:
其他好文 时间:
2014-08-17 14:18:12
阅读次数:
168