2012年3月18日
摘要: #include#includeusing namespace std;int main(){double k,x[1000],y[1000];double a,b;int i,count,stepnum;cin>>count;for(i=0;i>x[i]>>y[i];for(i=0;i=k&&k>a*a)stepnum=2*a;else if(ka*a+a)stepnum=2*a+1;}//whilecout<<stepnum<<endl;}//forreturn 0;} 阅读全文
posted @ 2012-03-18 23:42 Bester 阅读(109) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;int main(){char str1[10];char str2[10];char ch;int turn;int tempint;int i;int guess[2];//0代表左边那个,1代表右边那个while(1){guess[0]=0;guess[1]=11;while(1){cin>>tempint; if(!tempint)return 0;cin>>str1;cin>>str2;if(strcmp(str1,"too")==0){if(strcmp(str2,&qu 阅读全文
posted @ 2012-03-18 23:40 Bester 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 很早以前做的了,拿出来记录下。#include#includeconst int N=100001;struct Node{int v;struct Node *next;Node(int n=0,struct Node *P=NULL){v=n;next=P;}}node[N];struct Range{int b,e;}range[N];bool visited[N];int c[N];int n;void Dfs(int p,int &id);inline int Lowbit(int x){return x&(-x);}void Modify(int i,int v); 阅读全文
posted @ 2012-03-18 23:39 Bester 阅读(124) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;#define MAXSIZE 10000class QElemType{public:int x,y;};class SQueue{public:int len;int front;//头指针,若队列不空,指向队列头元素int rear;//尾指针,若队列不空,指向队列尾元素的下一个位置QElemType base[MAXSIZE];int InitQueue();//初始化一个队伍int QueueLength();//求队伍长度int EnQueue(QElemType e);//插入元素为e的新的队尾元素int DeQueue(Q 阅读全文
posted @ 2012-03-18 23:37 Bester 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 因为最近想做的一个东西和区间统计有关,心血来潮玩了下线段树。 #includeusing namespace std;#define MAXNUMBER 1leftIndex=0;treeRoot->rightIndex=this->cowNumber-1;//Compare the Left Child and Right Child resultFindTreeMinAndMaxValue(treeRoot);return;}void SegmentTree::FindTreeMinAndMaxValue(TreeNode *tNode){//See if the node e 阅读全文
posted @ 2012-03-18 15:34 Bester 阅读(179) 评论(0) 推荐(0) 编辑