上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 26 下一页
摘要: 简单的优先队列的应用;代码: 1 #include 2 #include 3 using namespace std; 4 5 struct node 6 { 7 int num; 8 int ti; 9 int period;10 bool operatort.num;13 return ti>t.ti;14 }15 };16 priority_queueq;17 char s[20];18 int main()19 {20 int m;21 node a;22 while(scanf("%s",&s)&&s[... 阅读全文
posted @ 2013-10-24 09:49 Yours1103 阅读(150) 评论(0) 推荐(0) 编辑
摘要: map的用法:代码: 1 #include 2 #include 3 #include 4 #define maxn 1000009 5 using namespace std; 6 7 vectorve[maxn]; 8 map >mp; 9 int n,m,x,y;10 int main()11 {12 while(scanf("%d%d",&n,&m)!=EOF)13 {14 mp.clear();15 for(int i=0;i();19 mp[x].push_back(i+1);20 }21 ... 阅读全文
posted @ 2013-10-23 23:15 Yours1103 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 题目很简单,就是不知道为啥总是runtime error;后来发现我是先判断的y!=p.front();应该先判断是否为空;哎!今天果然不宜A题啊!代码: 1 #include 2 #include 3 #include 4 using namespace std; 5 priority_queuepq; 6 queueq; 7 stacks; 8 bool flag[4]; 9 int main()10 {11 int n,x,y;12 while(scanf("%d",&n)!=EOF)13 {14 while(!q.empty())q.pop();... 阅读全文
posted @ 2013-10-23 22:57 Yours1103 阅读(182) 评论(0) 推荐(0) 编辑
摘要: A:简单题,因为题目中说了不会有数据相同; 1 #include 2 #include 3 #define maxn 200005 4 using namespace std; 5 6 struct node 7 { 8 int a[3]; 9 int id;10 bool operator =m2&&no[i].a[1]>=m3)34 bb[cnt++]=no[i].id;35 }36 printf("%d\n",cnt);37 sort(bb,bb+cnt);38 for(int i=0;i 2 #inclu... 阅读全文
posted @ 2013-10-21 21:26 Yours1103 阅读(708) 评论(0) 推荐(0) 编辑
摘要: 数值计算:这种积分的计算方法很好,学习一下!代码: 1 #include 2 #include 3 using namespace std; 4 const double eps = 10e-5; 5 6 double func(double a, double b, double x) 7 { 8 double r = a * exp(- x*x) + b * sqrt(x); 9 return r*r;10 }11 12 double integrate(double a, double b, double h)13 {14 unsigned long ste... 阅读全文
posted @ 2013-10-20 16:56 Yours1103 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 一个离散化的简单题;我用的是STL来做的离散化;好久没写离散化了,纪念一下!代码: 1 #include 2 #include 3 #include 4 #include 5 #define maxn 5005 6 using namespace std; 7 vectorve; 8 int mmb[12]={0,44640,84960,129600,172800, 9 217440,260640,305280,349920,393120,437760,480960};10 struct node11 {12 int st,end;13 }no[maxn];14 15 char s[1... 阅读全文
posted @ 2013-10-20 16:21 Yours1103 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 回文串的题,求最大的双重回文串;重新复习了一下manacher算法;代码: 1 #include 2 #include 3 #include 4 #define M 310010 5 using namespace std; 6 char b[M],a[M='A')17 b[i]=b[i]-'A'+'a';18 memset(a,0,sizeof a);19 n=0;20 a[n++]='?';21 a[n++]='#';22 for(i=1; b[i]!='\0'; i++)23 ... 阅读全文
posted @ 2013-10-18 15:21 Yours1103 阅读(331) 评论(0) 推荐(0) 编辑
摘要: A:大水题;代码: 1 #include 2 #define ll long long 3 using namespace std; 4 5 int main() 6 { 7 ll n,m,a; 8 cin>>n>>m>>a; 9 cout 2 #include 3 #define maxn 1000005 4 using namespace std; 5 int n; 6 char s[50]; 7 void a_to_b() 8 { 9 int a,b;10 int p=maxn-1;11 char t[maxn];12 sscan... 阅读全文
posted @ 2013-10-17 20:52 Yours1103 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 昨天学习了线段树的延迟标记;发现自己还有区间合并没有学;抓紧时间学习一下;代码: 1 #include 2 #include 3 #define maxn 200005 4 using namespace std; 5 6 struct tree 7 { 8 int l,r,msum,lsum,rsum,flag; 9 tree *right,*left; 10 }tr[maxn]; 11 int nonocount; 12 13 void build(tree *root,int l,int r) 14 { 15 root->l=l,root->... 阅读全文
posted @ 2013-10-17 11:55 Yours1103 阅读(116) 评论(0) 推荐(0) 编辑
摘要: A:超级大水题;代码: 1 #include 2 #define maxn 105 3 using namespace std; 4 int n,a[maxn],x,y,ans; 5 int main() 6 { 7 scanf("%d",&n); 8 for(int i=1; i=x&&a[i]=x&&(ans-a[i])n)printf("0");23 return 0;24 }View Code B:因为每次跳舞最多只有一个人以前跳过,所以很简单; 1 #include 2 #define maxn 1000 阅读全文
posted @ 2013-10-16 00:54 Yours1103 阅读(409) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 26 下一页