http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=203#problem/C
/* #include <iostream> #include <stdio.h> #include <queue> using namespace std; struct node { int x,y; }q1; int main() { queue<node>q; q1.x=2;q1.y=3; q.push(q1);//? 结构体数据的输入 q.pop(); printf("%d ",q.size()); return 0; } */ /* 双端队列 #include <iostream> #include <stdio.h> #include <deque> #include <string.h> using namespace std; int main() { string str[3] = {"程明","ss","sss"}; deque<string>ST(str,str+3); cout<<ST.front()<<endl; cout<<ST.back()<<endl; } */ /* #include<iostream> #include <stdio.h> #include <deque> #include <string.h> using namespace std; int main() { string Elem[0]; deque<Elem>c; return 0; } */ #include <stdio.h> #include <iostream> #include <queue> #include <vector> using namespace std; int t; int a[101][2001]; struct cmp { bool operator()(int &a,int &b) { return a>b; } }; int main() { int n,m; int i,j; queue<int>q1; queue<int>q2; priority_queue<int>q; priority_queue<int,vector<int>,cmp>que; scanf("%d",&t); while(t--) { scanf("%d%d",&m,&n); for(i = 1;i <= m;i++) { for(j = 1;j<=n;j++) { scanf("%d",&a[i][j]); } } for(i = 1;i<=m;i++) { k = i; for(j = 1;j<=n;j++) { sum = a[i][j] + [][] } } } } #include <stdio.h> #include <string.h> struct node { char name[11]; int v; }q[20001]; char str[11]; int n,m; int main() { int i,j; int k = 0; while(scanf("%d",&n),n) { for(i = 0;i<n;i++) { q[i].v = 1; } scanf("%d",&m); k = 0; for(i = 0;i<n;i++) { scanf("%s",&q[i].name); } for(i = 0;i<m;i++) { scanf("%s",str); for(j = 0;j<n;j++) { if(strcmp(q[j].name,str) == 1 && q[j].v == 1) { q[j].v = 0; k++; break; } } } printf("%d ",n-k); } return 0; } #include<stdio.h> #include<map> #include<string.h> #include<iostream> using namespace std; int n; int main() { while(scanf("%d",&n),n) { int count ; int i,m,ff; char s[30011][30]; char s1[30011][30]; map<string,int>st; scanf("%d",&m); for(i=1;i<=n;i++) { cin>>s[i]; for(ff=0;ff<strlen(s[i]);ff++) { if(s[i][ff]>='A'&&s[i][ff]<='Z') { s[i][ff]=s[i][ff]+32; } } st[s[i]]++; } for(i=1;i<=m;i++) { cin>>s1[i]; for(ff=0;ff<strlen(s1[i]);ff++) { if(s1[i][ff]>='A'&&s1[i][ff]<='Z') { s1[i][ff]=s1[i][ff]+32; } } st[s1[i]]--; } count=0; for(i=1;i<=n;i++) { if(st[s[i]]>=1) { count++; } } printf("%d ",count ); } return 0; } #include<iostream> #include<string> #include<map> using namespace std; int main() { char s[80]; while(cin>>s && s[0]!='*') { int len=strlen(s); if(len<=2) //长度小于等于2的串必定是surprising String { cout<<s<<" is surprising."<<endl; continue; } bool mark=true; //标记s是否为Surprising String for(int d=0;d<=len-2;d++) //d为当前所选取的两个字母之间的距离,d(max)=len-2 { map<string,bool>flag; bool sign=true; //标记D-pairs字母对是不是D-unique for(int i=0;i<=len-d-2;i++) //i为所选取的两个字母中第一个字母的下标 { char pair[3]={s[i],s[i+d+1],'