摘要: C++ Stack(堆栈) 是一个容器类的改编,为程序员提供了堆栈的全部功能,——也就是说实现了一个先进后出(FILO)的数据结构。操作 比较和分配堆栈 empty() 堆栈为空则返回真 pop() 移除栈顶元素 push() 在栈顶增加元素 size() 返回栈中元素数目 top() 返回栈顶元素 Lists将元素按顺序储存在链表中. 与 向量(vectors)相比, 它允许快速的插入和删除,但是随机访问却比较慢. assign() 给list赋值 back() 返回最后一个元素 begin() 返回指向第一个元素的迭代器 clear() 删除所有元素 empty() 如果list是空的则返 阅读全文
posted @ 2012-04-29 22:37 open your eyes 阅读(311) 评论(0) 推荐(0)
摘要: #include <stdio.h>#include <stdlib.h>#include <math.h>int T,k,n,ans,s;int main(){ scanf("%d",&T); for(int t=0;t<T;t++) { if(t) printf("\n"); scanf("%d",&k); if(!k){ printf("3\n"); continue; } k=abs(k); n=(int)sqrt(double(k<<1 阅读全文
posted @ 2012-04-29 09:30 open your eyes 阅读(221) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstring>#include<cctype>using namespace std;int main(){ int m,flag=1,n; while(cin>>m>>n) { cin.ignore(); char ch[100][100]; char c[100][100]; char ci[100]; int a[100]; memset(a,0,sizeof(a)); for(int i=0;i<m;i++) ... 阅读全文
posted @ 2012-04-29 09:29 open your eyes 阅读(230) 评论(0) 推荐(0)
摘要: #include<cstdio>#include<cstring>#include<cctype>#include<iostream>using namespace std;int main(){// freopen("input.txt", "r", stdin);// freopen("output.txt", "w", stdout); int c, m, j,n, k; char grid[60][60], word[60]; int md[8] = {-1, 阅读全文
posted @ 2012-04-29 09:29 open your eyes 阅读(171) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstring>#include<string>using namespace std;const int max=1000;struct bign{ int len; int s[max];};void init_bign(bign &b){ memset(b.s,0,sizeof(b.s)); b.len=1;}void fuzi_bign(bign &b,char *num){ b.len=strlen(num); for(int i=0;i<b.len;i++) b.s[i] 阅读全文
posted @ 2012-04-29 09:28 open your eyes 阅读(308) 评论(0) 推荐(0)
摘要: #include<iostream>#include<string>#include<cstring>using namespace std;int main(){ int n,sum[15][3]; char s[15][30]; while(cin>>n) { if(n==0)break; cin.ignore(); for(int i =0;i<n;i++) { cin.getline(s[i],30); for(int j=... 阅读全文
posted @ 2012-04-29 09:28 open your eyes 阅读(200) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstring>using namespace std;int aa[15],bb[50];void print(){ int i; for(i=1;i<41;i++) { if(bb[i]==0) cout<<" "; else if(bb[i]==1) cout<<"."; else if(bb[i]==2) cout<<"x"; else cout<<"W"; } ... 阅读全文
posted @ 2012-04-29 09:27 open your eyes 阅读(269) 评论(0) 推荐(0)
摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>char s[140];int len,i,j,a=0,b;int main(){ while (fgets(s,140,stdin)) { len =strlen(s); for (i=0;i<len;i++) { if (s[i]>48 && s[i]<58) { b = s[i]-'0'; a+=b... 阅读全文
posted @ 2012-04-29 09:27 open your eyes 阅读(869) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstring>#include<string>using namespace std;char s[100000];int main(){ while(cin.getline(s,100000)) { for(int i=0;i<strlen(s);i++) { cout<<char(s[i]-'1'+'*'); } cout<<endl; memset(s,0,sizeof(s)); } return 0;} 阅读全文
posted @ 2012-04-29 09:26 open your eyes 阅读(138) 评论(0) 推荐(0)