坐标系与基本图元(2)创建顶点缓冲区在创建顶点缓冲区之前,需要先定义一个表示顶点的结构类型,描述顶点保存格式的FVF和一个保存顶点的结构数组。struct sCustomVertex{ float x, y, z, rhw; DWORD color;};#define D3DFVF_CUSTOM_V...
分类:
其他好文 时间:
2014-09-01 12:23:53
阅读次数:
246
//构建队列#includeusing namespace std;struct queuenode{int data;queuenode* next;};class queue{private:queuenode* head;public:queue(){head=new queuenode;he...
分类:
编程语言 时间:
2014-09-01 10:29:32
阅读次数:
205
题目链接
题意:求sqrt(sqrt(2) + sqrt(3)) ^ 2n MOD 1024
思路:
代码:
#include
#include
#include
#include
#include
using namespace std;
const int MOD = 1024;
int n;
struct mat {
i...
分类:
其他好文 时间:
2014-09-01 00:29:32
阅读次数:
183
#include
#include
#include
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
bool hasCycle(ListNod...
分类:
其他好文 时间:
2014-08-31 23:04:12
阅读次数:
287
与静态属性类似,Swift中还定义了静态方法,也称为类型方法,所谓“类型”是指枚举、结构体和类。静态方法定义的方法也是与静态属性类似的,枚举和结构体的静态方法使用的关键字是static,类的静态方法使用的关键字是class。一、结构体中静态方法下面我们先看一个结构体静态方法的示例,代码如下:struct Account {
var owner : String = "Tony" ...
分类:
编程语言 时间:
2014-08-31 21:30:41
阅读次数:
377
MoveManager:移动管理类struct MoveOpt{ int cur_seq; ObjecInfo* obj;};std::map m_move_objs;//主要容器//加入移动标记void MoveManager::add_mask(ObjecInfo* obj){ ...
分类:
其他好文 时间:
2014-08-31 14:22:01
阅读次数:
228
1007 最近点对问题,采用分治法策略搞定 1 #include 2 #include 3 #include 4 using namespace std; 5 int n; 6 struct node 7 { 8 double x; 9 double y;10 }p[100005];11 i...
分类:
其他好文 时间:
2014-08-31 10:29:51
阅读次数:
197
??
1. istringstream字符串流
#include
#include
#include
using
namespace
std;
struct
MyStruct
{
string
str1,
str2,
str3;
double
db;
int
n...
分类:
其他好文 时间:
2014-08-30 23:11:28
阅读次数:
478
题意:给定一个单链表,判断该链表中是否存在环,如果存在,返回环开始的节点
思路:
1.定义两个指针,快指针fast每次走两步,慢指针s每次走一次,如果它们在非尾结点处相遇,则说明存在环
2.若存在环,设环的周长为r,相遇时,慢指针走了 slow步,快指针走了 2s步,快指针在环内已经走了 n环,
则有等式 2s = s + nr => s = nr
3.在相遇的时候,另设一个每次走一步的慢指针slow2从链表开头往前走。因为 s = nr,所以两个慢指针会在环的开始点相遇
复杂度:时间O(n)
struct...
分类:
其他好文 时间:
2014-08-30 23:07:40
阅读次数:
187
#include #include #include #include using namespace std; int n,M=9973;struct Matrax { int m[15][15];}; Matrax a,per; void initial(){ int i,j; ...
分类:
其他好文 时间:
2014-08-30 23:03:20
阅读次数:
236