简单的一个排序+贪心#include #include using namespace std;struct peo{ int x,y;};bool com(peo a,peo b){ return a.x>s>>n; for(int i=0;i>l[i].x>>l[i].y; ...
分类:
其他好文 时间:
2014-07-19 18:34:28
阅读次数:
207
模板的四大场景
1.数据类型与算法相分离的泛型编程
2.类型适配Traits
3.函数转发
4.元编程
回想起当时在学习C++模板时的无助和恐惧,现在还心有余悸,其实我现在都还是一样地的有畏惧,当看到模板套模板,不停地typedef,这样的变态代码的时候,就觉得很扯蛋,编程不是让人快乐的吗?这样痛苦是为了什么,写这样难看的东西是为了什么。有更好的动态语言为什么不用?我也想不明白,我也不想争论哪个语言更好。但我分享出来我的心得,只希望别人少走弯路....
分类:
编程语言 时间:
2014-07-19 18:17:29
阅读次数:
293
bfs,用数组来构建队列,用front指针来连接每一步输出的时候注意(0, 0)逗号后又一个空格。。。。被坑了一次#include using namespace std;struct step{ int x,y; step *front; void init(int xx,int yy){ x=x...
分类:
其他好文 时间:
2014-07-19 18:17:27
阅读次数:
260
数据定义: 1 /* 2 * 枚举类型定义 NO -> 没有线索化 YES -> 线索化了的 3 */ 4 enum Thread { NO, YES } 5 6 /* 7 * 线索二叉树的结点类型定义 8 */ 9 struct Node10 {11 Element...
分类:
其他好文 时间:
2014-07-19 14:32:38
阅读次数:
215
1 /* 2 * Author :SJQ 3 * 4 * Time :2014-07-16-20.21 5 * 6 */ 7 #include 8 #include 9 #include 10 using namespace std;11 12 struct ListNode {...
分类:
其他好文 时间:
2014-07-19 13:36:10
阅读次数:
166
一个简单的单词翻译的题,我是使用字典序做的;
由于输入的问题 ,,WA,WA,,,
都是泪;#include
#include
#include
using namespace std;
struct node{
int chile[26];
bool qq;
char uu[11];
node()
{
qq=0;...
分类:
其他好文 时间:
2014-07-19 12:08:48
阅读次数:
171
Description 请计算C[k]=sigma(a[i]*b[i-k]) 其中 k 11 #include12 const double PI=3.14159265359;13 struct P{double x,y;};14 P operator+(const P&a,const P&b){....
分类:
其他好文 时间:
2014-07-19 11:27:07
阅读次数:
178
用到tire树;
基础应用
这里讲的挺详细的 点击打开链接
#include
#include
#include
#define max 20
using namespace std;
char w[6];
struct node{
bool a;
int chile[26];
int q;//前缀
node(){
q=false;...
分类:
其他好文 时间:
2014-07-19 08:26:00
阅读次数:
181
结构体定义没搞明白,一直WA,终于AC了,真是高兴呀
代码如下:
#include
#include
#include
struct student
{
char id[30];
int score;
}person[1001];
int cmp(const void *a,const void *b)
{
struct student *aa=(struct studen...
分类:
其他好文 时间:
2014-07-19 08:15:25
阅读次数:
194
/*
c++ static变量,全局变量,局部变量
*/
#include
using namespace std;
static int x=1;
static int y=2;
struct A
{
static int x;
static int y;
};
int A::x=3;
int A::y= x;//3
//int A::y= ::x; //1
int mai...
分类:
其他好文 时间:
2014-07-19 02:48:26
阅读次数:
208