自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(312)
  • 资源 (1)
  • 收藏
  • 关注

原创 Unity 3D——Touch的用法

if (Input.touchCount >= 1) { Touch touch = Input.GetTouch(0); switch (touch.phase) { case TouchPhase.Began:

2014-08-29 15:28:56 4122

原创 Unity 3D——射线的应用

RaycastHit raycastHit = new RaycastHit(); Ray ray; ray = mainCamera.ScreenPointToRay(Input.GetTouch(0).position); if (Physics.Raycast(ray, out raycastHit, 6

2014-08-29 15:22:34 800

原创 Unity 3D——四元数的应用

四元数用于旋转,确实很不好理解,但是,有一点好处是不会发生万向锁。 主要用法就是:   首先,获取你当前的Rotation的四元数和目标Rotation的四元数,相乘即可。来自前辈的示范:

2014-08-21 14:02:47 1859

原创 贪吃蛇游戏

模仿http://zhidao.baidu.com/link?url=73YIrvyI57-_a7ur1H2rK1xjdK8oeTnUu28z6bL0hD28HOaLeeRoEYCh3p2YRTrKM0NP20atWAdFhnOklpMGn_#include#include#include#include#includeusing namespace std;#define N

2014-03-15 21:49:03 805

原创 LeetCode:Single Number//^的用法

&:都为1,才为1否则为零 ;|:有一个1就是1  ^:只能有一个1才是1。class Solution {public: int singleNumber(int A[], int n) { int x=A[0]; for(int i=1;i<n;i++) x=(x^A[i]); return x; }};

2014-03-04 16:22:07 626

原创 LeetCode:Insertion Sort List//链表插入排序

链表插入排序,注意点:       一、表头也是有存储数据的;二、最好空间为O(1),即在原链表上排序。/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL

2014-03-04 16:06:57 817

原创 Date类实现

头文件:#include#includeusing namespace std;class Date{private: int year,month,day; int lunar_year,lunar_month,lunar_day; string LunarHolDay;public: int get_y(){return year;} int get_m(){retur

2013-12-12 18:24:06 1098

原创 疑惑代码

#include#includeusing namespace std;class Triangular{public: Triangular(){_length=1;_beg_pos=1;_next=0;} Triangular(int len,int beg_pos){_length=len; _beg_pos=beg_pos;} int length()const {re

2013-10-17 15:20:59 572

原创 pat1064 Complete Binary Search Tree (30)——递归

思路:先将数组排序,每次计算每个二叉点的左孩子点数,并维护好[left,right] 区间。#include#includeusing namespace std;const int maxn =1005;int n,a[maxn],ans[maxn];int cmp(const void *a,const void *b){ return *(int *)a-*(int

2013-10-05 01:57:10 1659

原创 1053. Path of Equal Weight——深搜

方便输出的一点操作:将子节点根据weight来排序,这样遍历到符合要求的路径就可以直接输出! #include#include#include#includeusing namespace std;const int maxn=105;int n,m,s;class node{public: int cnt,flag; int son[maxn];};nod

2013-10-03 17:02:18 880

原创 1018. Public Bike Management (27分)——深搜

#include#include#includeusing namespace std;const int maxn=505;const int bignum=999999;int C,N,S,M;class node{public: int to,next,cost;};node edge[maxn*3];int head[maxn],cnt=0,vis[maxn],

2013-10-02 14:06:52 867

原创 1017. Queueing at Bank——优先队列

其实可以不用优先队列的! 优先队列需要重载“#include#include#include#include#includeusing namespace std; const int maxn =10003;class node{public: int h,m,s,pro; }; bool operator<(const node &a,const n

2013-10-01 01:50:10 694

原创 pat 1003. Emergency ——深搜

题目要求:找到到达目标的最短路径条数,并计算能到达目标点最多的人数!!#include#includeusing namespace std;const int maxN=505;const int bignum=999999;class node{public: int to,next,cost;};class st{public: int cost,man,

2013-09-30 22:25:07 997

原创 wxWidgets之grid 参照于sample

#include "wx/wxprec.h"#include"wx/wx.h"#include "wx/grid.h"#include "wx/dbtable.h"class wxGrid;class GridApp:public wxApp{public: bool OnInit();};class GridFrame:public wxFrame{public:

2013-09-12 20:55:41 1335

原创 wxWidgets之clipboard参照于sample.

#include "wx/wxprec.h"#ifndef WX_PRECOMP #include "wx/wx.h"#endif#include "HelloWorldApp.h"#include #include "wx/clipbrd.h"enum{ ID_Quit = wxID_EXIT, ID_About = wxID_ABOUT,

2013-09-11 21:35:34 823

转载 OpenGL初试

画一个三角形。#include#includevoid myDisplay(void){ glClear(GL_COLOR_BUFFER_BIT); /*glRectf(-0.5f,-0.5f,0.5f,0.5f);*/ glBegin(GL_POLYGON); glVertex2f(0.0f,0.0f); glVertex2f(0.5f,0.0f); gl

2013-08-09 20:45:33 595

原创 gtest的简单小程序

参照网上的,试写了一个!#includeusing namespace std;int Foo(int a,int b){ if(a==0||b==0) { throw "don't do that"; } int c=a%b; if(c==0) return b; return Foo(b,c);}TEST(FTest,HandleNoneZoretest){

2013-08-09 10:51:05 766

转载 Gtest在vs 2010上的配置

找了好多文章,发现这篇是讲得最简便、正确的!以下为复制&粘贴的:VS2010 gtest简易配置使用一个简单的控制台来演示。1.下载google testhttp://code.google.com/p/googletest/downloads/detail?name=gtest-1.6.0.zip&can=2&q= 2.解压,寻找目录msvc,直接运行sln文件,打开项目

2013-08-08 19:53:04 3089 3

原创 Tcl的学习

由于项目需要,快速过了一遍Tcl脚本语言基础。 set x 10; set y x+100 ; # y= x+100 set y $x+100 #变量置换 $ y=10+100 set y [expr $x+100] #命令置换 [] y=110 [把expr当做命令名 [] 中脚本的值为最后一个命令的返回值 expr将 $+100 参数做表达式处理set msg m

2013-08-08 14:26:21 1253

原创 C++学习之static(二)

#includeusing namespace std;/*--------------------static 学习-------*/int x=100;class withStatic { int i; static int x; static int y;public: void print() const { cout<<"x= : "<<x<<endl; c

2013-07-01 14:19:13 647

原创 C++学习之static(一)

#includeusing namespace std;/*--------------------static 学习-------*/char onechar(const char * charArray=0){ static const char *s;// ----------------1,只初始化一次 if(charArray) { s=charArray; r

2013-07-01 11:11:05 522

原创 C++学习之const常量

#include#includeusing namespace std;//const int * const w()//{// static int i;// return &i;//}/* ------------------------------------------------------------ 5,声明一个“成员函数”为const,则等于告诉编

2013-06-30 15:50:46 677

原创 创建Time 对象

创建2个Time对象,执行两for循环,显示时间延缓!Time类://:C09:Cpptime.h//A simple time class#ifndef CPPTIME_H#define CPPTIME_H#include#includeclass Time{ std::time_t t; std::tm local; char asciiRep[27]; uns

2013-06-29 15:51:40 746

原创 C++学习之内联函数

内联函数的学习。#include#include#includeusing namespace std;#define f(x) (x+1)#define floor(x,b) ((x)>=(b)?0:1)// 加括号的好处#define band(x) ((x)>5&&(x)<10 ? (x):0)inline int plusOne(int x) {return ++x;}

2013-06-29 15:20:18 592

原创 pat 1496 数列区间//线段树

题意:数列区间思路:还算是简单的线段树操作,关键两点:               1 ,更新过程;                2,最后的数列标记,记住是最长连续区间长的。给组测试数据: 3 2   1 3 2 2  答案:1代码:#include#include#include#includeusing namespace std;const int maxnode

2013-03-17 10:01:27 707

原创 CSDN,我又回来啦

RT.    哈哈,近期考研复习ing,加油!期待继续更新博客的那一刻!

2012-08-19 11:38:04 405

原创 All Is over

Done !

2012-03-28 17:28:59 549

原创 zoj3166 Lazy Tourist//floyd求两点间最短路

#include#include#include#includeusing namespace std;#define inf 100005#define N 105int g[N][N],dist[N][N];int n,c;int cs[N];int cmp(const void *a,const void *b){ return *(int *)a>*(int *)b

2012-03-20 19:47:44 569

原创 zoj 3197 Google Book//最小区间覆盖

最悲哀的,莫过于死活不过...#include#include#include#includeusing namespace std;#define N 5005class node{public: int left,right;};node st[N];int n;int cmp(const void *a,const void *b){ node *c =(n

2012-03-19 13:57:05 741

原创 ZOJ 3107 Counting Squares//计算几何

题意:按指令画多边形,求出里面有多少个正方形。思路:求出面积。注意:需判断多边形的走向,利用叉积的正负个数。#include#include#include#includeint dir[][4]={{0,1},{0,-1},{-1,0},{1,0}};int f(char ch ){ if(ch=='U') return 0; else if(ch=='D') retur

2012-03-19 13:08:56 525

原创 zoj3123 Subsequence//最短序列和

毫无优化时,TLE, 加入二分优化,时间为50ms.强大的二分AC代码:#include#include#includeusing namespace std;#define N 100005int a[N];int main(){ int t; cin>>t; while(t--) { int n,s; int su=0; scanf("%d%d",&

2012-03-18 15:58:13 631

原创 hdu 1176免费馅饼 //dp

#include#include#includeusing namespace std;#define ma(x,y) ((x>y?x:y))int dp[11][100005],time[11][100005];int main(){ int n; while(scanf("%d",&n)!=EOF&&n) { memset(dp,0,sizeof(dp)); mem

2012-03-18 12:48:01 413

原创 hdu1466 计算直线的交点数//dp+set

#include#include#includeusing namespace std;class node{public: sett;};node st[21];int main(){ st[1].t .insert (0); st[2].t .insert (0); st[2].t .insert (1); st[3].t .insert (0); st[3].

2012-03-17 20:25:08 684

原创 zoj 3513 Human or Pig//

题意难读懂。理解这句:猪随意跳,人可以选择。要确保跳河里的时候,是猪就行。#include#includeusing namespace std;int n,m;char s[51000];bool find(int x,int y,int cul){ int k=1,temp; if(x>y) { int tempx =x-k*y; while(tempx>=0)

2012-03-16 13:38:50 507

原创 zoj3551 Bloodsucker//概率&dp

参考:http://raya.blogcn.com/articles/zoj-3551.html#include#includeusing namespace std;double dp[100005];int main(){ int t,n; double p; scanf("%d",&t); while(t--) { scanf("%d%lf",&n,&p);

2012-03-15 19:39:45 621

原创 zoj3321Circle//回路判断

题目提示只有一条回路。思路:并查集+出入度检测。#include#include#include#includeusing namespace std;int n,m;int f[20],rank[20],vis[20];void solve(int a[]){ for(int i=1;i<=n;i++) if(a[i]!=0&&a[i]!=2) { cout<

2012-03-11 19:13:48 606

原创 zoj 3230Solving the Problems//优先队列

#include#include#include#include#includeusing namespace std;#define N 100005class node{public: int a,b;};bool operator< (const node &a,const node &b){ if(a.b<b.b ) return true; return f

2012-03-10 20:21:08 516

原创 zoj 3204 Connect them//最小生成树

kru算法。#include#include#include#includeusing namespace std;int n,g[111][111];class node{public: int u,v,len;};int len;node edge[110000];int pre[111];void input(){ for(int i=1;i<=n;i

2012-03-10 19:39:13 560

原创 观《迫在眉捷》有感

心情实在是差,so terrible.在风行上挑了部电影看。        影片刚开始,就描述了美国萧条时期,约翰因无钱还房贷,车子被拖了。当然,这不是最糟糕的。在一场棒球赛上,约翰的儿子的心脏出了问题。        这时候,如果想要儿子活下来,约翰需要约7万美元。It is a big trouble for him。After having tried his best, he st

2012-03-10 01:00:34 2429

原创 zoj3519 Who is the Smartest Man//贪心

#include#include#include#includeusing namespace std;int p[506];int cc,n;int cmp(const void *a,const void *b){ return *(int *)a-*(int *)b;}int main(){ while(scanf("%d%d",&n,&cc)!=EOF) {

2012-03-09 19:00:18 522

创建学生信息管理系统

创建一个存储和显示学生信息的单文档应用程序。 功能如下:在编辑框中输入学生信息,单击“输入”按钮时,程序检测编号与以后学生信息是否重复,如果重复则跳出消息框提示“学号重复,请修改学生学号”,如果编号和姓名栏中是空的,系统提示“学生信息不全,请补全信息”,如果无上述情况,系统自动把输入内容存储到文档类中的一个学生信息类对象的数组中; 主菜单“编辑”中包含了“清空”子菜单,单击该子菜单或者点击工具栏上的红色“C”按钮时,删除所有学生的信息,并且清空界面上的“编号”和“姓名”编辑栏。

2010-12-06

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除